from random import randint
random_number = randint(1, 10)
guesses_left = 3
while guesses_left != 0:
guess = int(raw_input("Your guess: "))
if guess != random_number:
guesses_left -= 1
print 'Nope, please try again! guesses left: ',guesses_left
elif guess == random_number:
print 'You win! Thanks for playing.'
print 'Sorry, you lose!'
I'm getting the error message:
Oops, try again.
Did you include an else for the while loop?
If I don't indent the else statement I get and indentation error, and if I only indent it once then it keeps saying my break command is outside the loop.
Everything works fine until you lose the game, then it doesn't seem to run through my else statement.
I'm really not seeing what I'm doing wrong here. Any help will be appreciated.