Indentations what are they?

i don’t quite understand indentations could someone explain?

Python uses indentation to to indentify scope, much like most C-family languages use curly braces ({}).

Hello Simitsu,
Of course! Identations are the spaces/tabs that tells python where code is part of.


if 5 > 3:
    print("Yes") # Inside the for loop.
print("I am a print") # Outside the for loop.

Because the first print has 4 spaces (or a tab) in front of it, it tells python that the print only gets printed if the if statement is true. But because the second print has no identation it is not part of the if statement and will be printed anyway.

It’s important to have the right indentation to tell the code what is what. This is also very important for classes, loops, functions, etc.