1. Use a while loop to let the user keep guessing so long as guesses_left is greater than zero.
2. Ask the user for their guess, just like the second example above.
3. If they guess correctly, print 'You win!' and break.
4. Decrement guesses_left by one.
5. Use an else: case after your while loop to print You lose..
Oops, try again. Your code looks a bit off. Check the Hint if you need help! Your code threw the following error: invalid literal for int() with base 10: ''
Error Message on Console:
Traceback (most recent call last):
File "python", line 9, in
ValueError: invalid literal for int() with base 10: ''
I don't really get what this is asking me to do....
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!" break guesses_left -= 1 else: print "You lose."