Python is one of the very few programming languages that relies on the use of indentation (tabs) to work.
Usually, one indentation has four spaces in Python.
For example:
The above example returns:
If we were to rewrite the above snippet as:
The output will be:
The indentation determines whether the last call to print belongs to the else statement or whether it should be called separately from the if statement.
As a side note, indentation doesn’t matter for commented out lines. To comment out lines of code in Python, just use the hash symbol, #. For example: