Indentation matters. Each line under the if statement that is indented will 
only be executed if the statement is true:

if a == 1:
    print("If a is one, this will print.")
    print("So will this.")
    print("And this.")
 
print("This will always print because it is not indented.")

Indentation must be the same. This code doesn't work.

if a == 1:
  print("Indented two spaces.")
     print("Indented four. This will generate an error.")
    print("The computer will want you to make up your mind.")

Why does the first example work and the 2nd example doesn't work ? Can someone 
explain in layman's terms what indentation is and why the first one works and 
the 2nd one doesn't ? Thanks alot

Gengyang
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to