Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #57747

Re: indentation blocking in Python

From "Colin J. Williams" <cjw@ncf.ca>
Newsgroups comp.lang.python
Subject Re: indentation blocking in Python
Date 2013-10-27 11:37 -0400
Organization National Capital Freenet, Ottawa, Ontario, Canada
Message-ID <526D3336.4090508@ncf.ca> (permalink)
References <96fc985d-725e-4fe7-8d30-0bcaad91f975@googlegroups.com>

Show all headers | View raw


On 27/10/2013 11:31 AM, ajetrumpet@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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

indentation blocking in Python ajetrumpet@gmail.com - 2013-10-27 08:31 -0700
  Re: indentation blocking in Python "Colin J. Williams" <cjw@ncf.ca> - 2013-10-27 11:37 -0400
  Re: indentation blocking in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-27 15:44 +0000
  Re: indentation blocking in Python Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2013-10-27 16:40 +0100

csiph-web