Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #24625 > unrolled thread
| Started by | Sergi Pasoev <s.pasoev@gmail.com> |
|---|---|
| First post | 2012-06-28 21:30 +0400 |
| Last post | 2012-06-30 02:02 +1000 |
| Articles | 7 — 5 participants |
Back to article view | Back to comp.lang.python
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
| From | Sergi Pasoev <s.pasoev@gmail.com> |
|---|---|
| Date | 2012-06-28 21:30 +0400 |
| Subject | Re Following syntax error in Mac OX10.7 Terminal |
| Message-ID | <871ukzs5rx.fsf@gmail.com> |
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.
[toc] | [next] | [standalone]
| From | David Thomas <dthomas86@me.com> |
|---|---|
| Date | 2012-06-29 08:13 -0700 |
| Message-ID | <7e3890e4-3225-47f1-99e8-e5574c6413ef@googlegroups.com> |
| In reply to | #24625 |
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.
[toc] | [prev] | [next] | [standalone]
| From | MRAB <python@mrabarnett.plus.com> |
|---|---|
| Date | 2012-06-29 16:21 +0100 |
| Message-ID | <mailman.1633.1340983502.4697.python-list@python.org> |
| In reply to | #24657 |
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!
[toc] | [prev] | [next] | [standalone]
| From | David Thomas <dthomas86@me.com> |
|---|---|
| Date | 2012-06-29 08:58 -0700 |
| Message-ID | <4c2a80da-70bd-48c0-92c9-c7182d3578b3@googlegroups.com> |
| In reply to | #24659 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Andrew Berg <bahamutzero8825@gmail.com> |
|---|---|
| Date | 2012-06-29 21:05 -0500 |
| Message-ID | <mailman.1646.1341021946.4697.python-list@python.org> |
| In reply to | #24660 |
On 6/29/2012 10:58 AM, David Thomas wrote: > 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. The latest edition (3rd?) of Programming Python by Mark Lutz covers py3k (it targets 3.0/3.1 IIRC, but the official Python docs cover the differences between versions). The tutorial in the official docs is short compared to a book, but it covers the basics well. The official docs do cover each module in the standard library in great detail. It is mainly reference, though there are a few tutorials (e.g. the logging module has at least 2 tutorials). If you are not restricted to 2.x, learn 3.2/3.3. 2.x is used mainly because some major libraries (e.g., Twisted, Django) and/or other dependencies do not support 3.x yet. There will be no 2.8, and 2.7 isn't getting any new features AFAIK. -- CPython 3.3.0a4 | Windows NT 6.1.7601.17803
[toc] | [prev] | [next] | [standalone]
| From | David Thomas <dthomas86@me.com> |
|---|---|
| Date | 2012-06-29 08:58 -0700 |
| Message-ID | <mailman.1634.1340985541.4697.python-list@python.org> |
| In reply to | #24659 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Date | 2012-06-30 02:02 +1000 |
| Message-ID | <87fw9eqf71.fsf@benfinney.id.au> |
| In reply to | #24657 |
David Thomas <dthomas86@me.com> writes: > Hi yeah I'm currently learning python 2 at the moment and the tutorial > that I am studying doesn't explain about indentation. You might be better served by the official Python tutorial <URL:http://docs.python.org/tutorial/>. If you work through it from beginning to end, doing each exercise and experimenting to be sure you understand before moving through, you will get a good grounding in the fundamentals of the language. -- \ “Don't worry about what anybody else is going to do. The best | `\ way to predict the future is to invent it.” —Alan Kay | _o__) | Ben Finney
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web