8/19 why is this invalid syntax?


#1

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
else:
guess_left -= 1
else:
"You Lose"

for whatever reason this is giving me the following error:
File "python", line 10
if guess == random_number:
^
SyntaxError: invalid syntax


#2

you are missing a closing parentheses
guess = int(raw_input("Your Guess: "))


#3

The answer
from random import randint

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

guesses_left = 3

while guesses_left > 0:
# Start your game!
    guess = int(raw_input("Your guess: "))
    guesses_left -= 1
    if guess == random_number:
        print "you win!"
        break
    
else:
    print "you lose"

#4

thank you! that was my error as well.

but I wished it would have told us the error was on line 9 instead of line 10. any idea why that is?