[Tutor] Help with Guess the number script

Dave Angel davea at davea.name
Tue Mar 11 07:18:51 CET 2014


 Scott W Dunning <swdunning at cox.net> Wrote in message:
>

Would you please stop posting in html?

> 
 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:
        print
        print "Too high!"
    if guess < secret - 10 or guess > secret - 10:

Think about that line. You might even want to put in a separate
 function to test what it does.
HINT: it's wrong.

        print "You are cold!"
        print
        print "Sorry please try again."
        print
        print
    elif guess < secret - 5 or guess > secret - 5:

Same mistake. 

        print "You are warmer!"
        print
        print "Sorry please try again."
        print
        print
    else:
        print "You're on fire!!"
        print
        print "Sorry please try again."
        print
        print


-- 
DaveA



More information about the Tutor mailing list