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


Groups > comp.lang.python > #57747

Re: indentation blocking in Python

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.news.ox.ac.uk!news.ox.ac.uk!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.xcski.com!ncf.ca!not-for-mail
From "Colin J. Williams" <cjw@ncf.ca>
Newsgroups comp.lang.python
Subject Re: indentation blocking in Python
Date Sun, 27 Oct 2013 11:37:26 -0400
Organization National Capital Freenet, Ottawa, Ontario, Canada
Lines 23
Sender fn681@206-47-116-80.dsl.ncf.ca
Message-ID <526D3336.4090508@ncf.ca> (permalink)
References <96fc985d-725e-4fe7-8d30-0bcaad91f975@googlegroups.com>
NNTP-Posting-Host 206-47-116-80.dsl.ncf.ca
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace theodyn.ncf.ca 1382888260 26312 206.47.116.80 (27 Oct 2013 15:37:40 GMT)
X-Complaints-To complaints@ncf.ca
NNTP-Posting-Date 27 Oct 2013 15:37:40 GMT
To ajetrumpet@gmail.com
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.0.1
In-Reply-To <96fc985d-725e-4fe7-8d30-0bcaad91f975@googlegroups.com>
Xref csiph.com comp.lang.python:57747

Show key headers only | 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