Why do we need to indent this like the same?


#1


#2

Python syntax dictates that indentation for related statements must be the same, and all statements nested inside of these must be indented one more than the outside statement. This allows the compiler to read the code and understand what code is in what block, without the use of enclosing characters such as {}.

See a peachpit.com article on the subject.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.