[Tutor] Help with Guess the number script

Scott W Dunning swdunning at cox.net
Sat Mar 8 02:23:43 CET 2014


On Mar 7, 2014, at 11:02 AM, Alan Gauld <alan.gauld at btinternet.com> wrote:

GOT IT!!  Finally!  Thanks for all of your help!!

This is what I got, not sure if it’s correct but it’s working!

def print_hints(secret, guess):
    if guess < 1 or guess > 100:
        print
        print "Out of range!"
        print
    if guess < secret:
        print
        print "Too low!"
        if guess < secret - 10:
            print "You are cold!"
            print
            print "Please play again!"
        elif guess < secret - 5:
            print "You are warmer!"
            print
            print "Please play again"
        else:
            print "You're on fire!!"
            print
            print "Please play again"
    if guess > secret:
        print
        print "Too high!"
        if guess > secret + 10:
            print "You are cold!"
            print
            print "Please play again!"
        elif guess > secret + 5:
            print "You are warmer!"
            print
            print "Please play again"
        else:
            print "You're on fire!!"
            print
            print "Please play again"

   



More information about the Tutor mailing list