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


Groups > comp.lang.python > #24661

Re: Re Following syntax error in Mac OX10.7 Terminal

Newsgroups comp.lang.python
Date 2012-06-29 08:58 -0700
References <871ukzs5rx.fsf@gmail.com> <7e3890e4-3225-47f1-99e8-e5574c6413ef@googlegroups.com> <mailman.1633.1340983502.4697.python-list@python.org>
Subject Re: Re Following syntax error in Mac OX10.7 Terminal
From David Thomas <dthomas86@me.com>
Message-ID <mailman.1634.1340985541.4697.python-list@python.org> (permalink)

Show all headers | View raw


On Friday, June 29, 2012 4:21:56 PM UTC+1, MRAB wrote:
> On 29/06/2012 16:13, David Thomas wrote:
> > On Thursday, June 28, 2012 6:30:42 PM UTC+1, Sergi Pasoev wrote:
> >> You just have to consider that indentation matters in Python, so you
> >> have to type the code in Python interpreter as you have written it
> >> below, that is, press Tab before each line when you are inside the
> >> 'while (or any other like for, if, with, etc.) block.
> >>
> >> a=0
> >> while a<10:
> >>     a=a+1
> >>     print a
> >>
> >> I can guess from your message that you aren't aware of one very
> >> important Python feature, and maybe you also didn't willingly choose to
> >> learn Python2 instead of Python3 ? In this case I would advise you to
> >> consider both versions before choosing.
> >
> > Hi yeah I'm currently learning python 2 at the moment and the tutorial that
> > I am studying doesn't explain about indentation.
> >
> Really? Indentation is a basic feature of Python!

while {condition that the loop continues}:
    {what to do in the loop}
    {have it indented, usually four spaces}
{the code here is not looped}
{because it isn't indented}

Just discovered this in the tutorial further down.  I'm currently learning Python 2 because there seems to be a lot of tutorials out there covering Python 2 rather than 3.

Thanks for the help this community is great for help.

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


Thread

Re Following syntax error in Mac OX10.7 Terminal Sergi Pasoev <s.pasoev@gmail.com> - 2012-06-28 21:30 +0400
  Re: Re Following syntax error in Mac OX10.7 Terminal David Thomas <dthomas86@me.com> - 2012-06-29 08:13 -0700
    Re: Re Following syntax error in Mac OX10.7 Terminal MRAB <python@mrabarnett.plus.com> - 2012-06-29 16:21 +0100
      Re: Re Following syntax error in Mac OX10.7 Terminal David Thomas <dthomas86@me.com> - 2012-06-29 08:58 -0700
        Re: Re Following syntax error in Mac OX10.7 Terminal Andrew Berg <bahamutzero8825@gmail.com> - 2012-06-29 21:05 -0500
      Re: Re Following syntax error in Mac OX10.7 Terminal David Thomas <dthomas86@me.com> - 2012-06-29 08:58 -0700
    Re: Re Following syntax error in Mac OX10.7 Terminal Ben Finney <ben+python@benfinney.id.au> - 2012-06-30 02:02 +1000

csiph-web