[Tutor] Guess my number?

. , administrata at hotmail.com
Sun Aug 7 16:49:11 CEST 2005

I want the program to say "You're stupid!" When a player fails to guess in 
10 tries.
But, it's not working..

import random

number = random.randrange(100) + 1
guess = int(raw_input("Take a guess: "))
tries = 1

while (guess != number):
    if (guess > number):
        print "Lower...\n"
    elif (guess < number):
        print "Higher...\n"
    elif (tires > 10):
        print "You're stupid!"
        print "Error!"

    guess = int(raw_input("Take a guess: "))
    tries += 1

print "\nYou guess it! The number was", number
print "And it only took you", tries, "tries!\n"
raw_input("\n\nPress the enter key to exit.")

Express yourself instantly with MSN Messenger! Download today it's FREE! 

More information about the Tutor mailing list