I wanted to experiment a little bit with this game and also send a message telling the user how many guesses they have left, I run into issues with a syntax error when I try to print guesses_left to the user, and even if I remove that it does print you lose if you run out of guesses and codecademy asks me if I put in an else statement.
from random import randint # Generates a number from 1 through 10 inclusive random_number = randint(1, 10) print random_number guesses_left=3 while guesses_left > 0: guess=int(raw_input("Your guess: ")) if guess == random_number: print "You win!" break elif guess != random_number: print "You've used one guess, you have" guesses_left "guesses left." guesses_left -= 1 else: print "You lose."
this is the first experience with coding I've ever had, so any help is greatly appreciated thank you.