top of page

Python Indentation

Python program statements are written one above the other, as shown in the following example:


print ("Bala was here")
print ("not working")
print ("having fun with Python")


The 3 line program above is correct and will run producing the expected output.


The program below will generate a syntax error 
because of the space character inserted at the start of the second line.


print ("Bala was here")
 print ("not working")
print ("having fun with Python")

 

© 2015 Thirumurugan

bottom of page