[Tutor] Help with "Guess the number" script

Scott W Dunning swdunning at cox.net
Tue Mar 4 06:10:22 CET 2014


On Mar 3, 2014, at 3:29 AM, spir <denis.spir at gmail.com> wrote:

I have another question in regard to this guess the number script I’m working on.  I’m banging my head over why this isn’t working….

def print_hints(secret, guess):
    if guess < 1 or guess > 101:
        print
        print "Out of range!"
        print
    if guess < secret:
        print
        print "Too low!"
        if guess < (secret - 10) or guess > (secret - 10):
            print "You are cold!"
            print
            print "Please play again!"
    if guess > secret:
        print
        print "Too high!"
        print
        print "Please play again!"
        if guess < (secret - 5) or guess > (secret - 5):
            print "You are cold!"
            print
            print "Please play again!”

I keep getting a syntax error about the indenting for this elif being wrong?  Any suggestions?

    elif:
        print "You're on fire!!"


Thanks again!!

Scott


More information about the Tutor mailing list