Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #24622 > unrolled thread
| Started by | David Thomas <dthomas86@me.com> |
|---|---|
| First post | 2012-06-28 10:11 -0700 |
| Last post | 2012-06-28 11:22 -0700 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.python
Following syntax error in Mac OX10.7 Terminal David Thomas <dthomas86@me.com> - 2012-06-28 10:11 -0700
Re: Following syntax error in Mac OX10.7 Terminal Andrew Berg <bahamutzero8825@gmail.com> - 2012-06-28 12:31 -0500
Re: Following syntax error in Mac OX10.7 Terminal David Thomas <dthomas86@me.com> - 2012-06-28 11:22 -0700
| From | David Thomas <dthomas86@me.com> |
|---|---|
| Date | 2012-06-28 10:11 -0700 |
| Subject | Following syntax error in Mac OX10.7 Terminal |
| Message-ID | <5eacd83f-03c9-43b5-b799-733aa576b1df@googlegroups.com> |
Hi,
I have the following error regarding a loop tutorial found on http://www.sthurlow.com/python/lesson04/
>>> a=0
>>> while a<10:
... a=a+1
File "<stdin>", line 2
a=a+1
^
IndentationError: expected an indented block
When I run Python IDE it seems to work fine. The following code is:
a=0
while a<10:
a=a+1
print a
Kind regards
[toc] | [next] | [standalone]
| From | Andrew Berg <bahamutzero8825@gmail.com> |
|---|---|
| Date | 2012-06-28 12:31 -0500 |
| Message-ID | <mailman.1614.1340904733.4697.python-list@python.org> |
| In reply to | #24622 |
On 6/28/2012 12:11 PM, David Thomas wrote: > Hi, > I have the following error regarding a loop tutorial found on http://www.sthurlow.com/python/lesson04/ > >>>> a=0 >>>> while a<10: > ... a=a+1 > File "<stdin>", line 2 > a=a+1 > ^ > IndentationError: expected an indented block You indented in the IDE, but not in the interpreter. Indent with a space or a tab. In Python, indentation is syntactically important. Everything indented will be part of that while loop; the next line that isn't indented will be considered not part of the loop. -- CPython 3.3.0a4 | Windows NT 6.1.7601.17803
[toc] | [prev] | [next] | [standalone]
| From | David Thomas <dthomas86@me.com> |
|---|---|
| Date | 2012-06-28 11:22 -0700 |
| Message-ID | <f57dbd5b-1ec7-4ae1-bfca-693c800174af@googlegroups.com> |
| In reply to | #24626 |
Thank you very much I didn't realise that the indentation was important. The IDE indents automatically whilst terminal doesn't. Thanks for pointing it out.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web