Your own while else


Oops, try again. Did you print the "You lose." message?

from random import randint

# Generates a number from 1 through 10 inclusive
random_number = randint(1, 10)

guesses_left = 3
# Start your game!

while guesses_left >0:
    guess = int(raw_input("your guess: "))
    if guess == random_number :
        print "you win"
    elif guess != random_number:
        guesses_left = guesses_left-1
    print "you loose"


if i win i am moving ahead in the excercise, but if i don't guess right it is throwing an error even if i get a print out you loose


you should print "You lose." (not loose)


thank you... ! i spent more that 3 hours.. !!!! just for a o


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.