indentation blocking in Python

Colin J. Williams cjw at ncf.ca
Sun Oct 27 11:37:26 EDT 2013


On 27/10/2013 11:31 AM, ajetrumpet at gmail.com wrote:
> a=1;
> if a==1: print(1)
> else: print(0)
> wait = input("press key")
You indent only subordinate statements.

You don't need a semi-colon unless it separates two statements on the 
same line.

Your code:

a=1
if a==1:
     print(1)
else:
     print(0)
wait = input("press key")

I hope that this helps.

Colin W.




More information about the Python-list mailing list