Python Indentation

Indentation is the addition of white spaces at the beginning of a statement/block of code.

In most programming languages, indentation is used just for readbility but in python, it is syntactically important. In python, indentation is used to "indent" code blocks.

You can indent code blocks using tabs or spaces in your keyboard, but the number of spaces must be uniform in a block of code.

Using an if loop to demonstrate an example:

        
            
        #You can use tabs or spaces in your keyboard to indent your code
        #Using an if loop to exceute the code within in if the condition is satisfied
        if 3 == 3:
            print("Hello World!")
        
      

Here, we are using an if loop with a condition (3 = 2 + 1) and if t he condition is satisfied, the code block within it will execute.

When you have multiple diffierent code-blocks, you need to indent them seperately as shown:

        
            
        if 3 == 3:
            print("Hello World!") 
        if 10 > 9:
                print("Hello World!")