Indentation is a must when writing block code in Python. Indentation is useful when you are writing functions, decision-making statements, looping statements, and classes. This makes it easy to read your Python programs.
We use indentation to indicate the block of code in Python programs. To indent a block of code, you can use spaces or tabs. Refer to the following example:
if val1 > val2:
print ("val1 is greater than val2")
print("This part is not indented")
In the preceding example, we indented the print statement because it comes under the if block. The next print statement doesn't come under the if block and that's why we didn't indent it.