Indentation in Python
Indentation is a very important concept of Python because without proper indentation the Python code will end up with IndentationError and the code will not get compiled.
Python indentation is a way of telling a Python interpreter that the group of statements belongs to a particular block of code. A block is a combination of all these statements. Block can be regarded as the grouping of statements for a specific purpose
- def add():
- #one tab space is preferd as indention generally.
- It simply means adding whitespace before statement.
- 1 Tab space is considered as one indentation.
- 1 Tab space is equal to 4 white space.
- Genrally , after every ‘:’ we use Indentation.
Hello Prepsters we are here to help you.
File "main.py", line 4
print('Hello Prepsters we are here to help you.')
IndentationError: expected an indented block