[Tutor] beginner help!!!!

Mike Hansen mhansen at cso.atmel.com
Thu Sep 2 21:07:34 CEST 2004

Are you using IDLE's Python Shell to type in your program? If so, you 
can get a little hung up with typing if  else statements.

IDLE 1.0.3     
 >>> x = 1
 >>> if x == 1:
    print "something"
SyntaxError: invalid syntax

 >>> if x == 1:
    print "something"
    print "something else"


I had to type a backspace at the line I wanted the else clause to be 
placed. You need to assume the >>> prompt isn't there when getting the 
indentation lined up when using the Python Shell.

If you aren't using the Python Shell, then ignore this post.


>     -----Original Message-----
>     *From:* Jill and Paul [mailto:bear4 at zoominternet.net]
>     *Sent:* Saturday, August 28, 2004 7:04 PM
>     *To:* tutor at python.org
>     *Subject:* [Tutor] beginner help!!!!
>     I am very new at learning Python and I am trying to type in a
>     program for practice.  It has "else:" in it and I keep getting
>     either a syntax error message or an indentation error no matter
>     what I do.  HELP!!!!!
>     Jill

More information about the Tutor mailing list