Python Indentation


Python Continue….

Indentation refers to the spaces at the beginning of a code line. Python provides no braces to point blocks of code for sophistication and performance definitions or flow control. Blocks of code are denoted by line indentation, which is rigidly enforced.

Both tabs and spaces are supported, but the quality indentation requires standard Python code to use four spaces.

Indentation Example:

if True:
   print("True")
else:
   print("False")

Python will give you an error if you skip the indentation.

if True:
print("True")
File "<stdin>", line 2
print("True")
^

IndentationError: expected an indented block


%d bloggers like this: