My code seems to me to work correctly, but I keep getting an "Oops try again..." course error message.
If I lose I get: Did you print the "You win!" message?
If I win I get: Did you print the "You lose." message?
I expect to be able to move onward, - what is my error so that I don't fall foul of it again!
from random import randint # Generates a number from 1 through 10 inclusive random_number = randint(1, 10) guesses_left = 3 while guesses_left > 0: guess = int(raw_input("Your guess: ")) if guess == random_number: print "Sorry, you lose!" print "The hidden was:", random_number break guesses_left -= 1 else: print "The hidden number is:", random_number print "You win!"