[Tutor] Just a Python formatting question

Kristiano Ang kristiano7 at gmail.com
Wed Jun 8 18:48:42 CEST 2005

Hey guys,
  I'm pretty new to Python (using Mac Python 2.4.1) and have a
question with formatting that I hope you can help me with.

  Sometimes, when I write code with Python (copied off tuts.), I get
error messages and highlights of the word "else". Take for example:

#plays the guessing game higher or lower

#originally written by Josh Cogliati, improved by Quique and copied by
Kristiano Ang


while guess != number:
    guess=input ("Guess a number:")
    if guess > number:
        print "Too High"
    elif guess < number:
            print "Too low"

 print "Just right"

I just can't get it to run and I get some indentation error.

  I'm pretty new to this so I'm sorry if this question(s) sound(s)
amateurish. Do help.

-Kristiano Ang

More information about the Tutor mailing list