[Pythonmac-SIG] Whats the invalid syntax about

2009-05-31 Thread beegee beegee
Hello, I have a mac mini mac os 10.4.11 aquamacs 22.3.1.
I wrote this program (please see below) after i got a python prompt (this
was after starting the interpreter in aquamacs)
please suggest what could have gone wrong here why am i getting a syntax
error

some_list = [3,6,2,5]
i=1
while i  3:
   print some_list[i], ;
   i=i+1
print some_list[3]
   File stdin, line 4
   print some_list[3]
   ^
SyntaxError: invalid syntax

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Whats the invalid syntax about

2009-05-31 Thread skip

 please suggest what could have gone wrong here why am i getting a
 syntax error

It's a quirk of the interactive interpreter.  To terminate a loop you need a
blank input line:

 some_list = [3,6,2,5]
 i = 1
 while i  3:
...   print some_list[i], ;
...   i = i + 1
... 
6 ;
2 ;
 print some_list[3]
5

-- 
Skip Montanaro - s...@pobox.com - http://www.smontanaro.net/
America's vaunted free press notwithstanding, story ideas that expose
the unseemly side of actual or potential advertisers tend to fall by the
wayside.  Not quite sure why.  -- Jim Thornton
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig