Python your own while/else


#1

hello, i need help for this exercise. My code is:

from random import randint

Generates a number from 1 through 10 inclusive

random_number = randint(1, 10)

guesses_left = 3

while guesses_left>0:
random_number = randint(1,10)
guess = (int(raw_input("Your guess: ")
if guess == random_number
print "You win!"
break
guesses_left -=1
else:
print "You lose."

The error i get is this.
File "python", line 12
print 'You win!'
^
SyntaxError: invalid syntax

this makes no sense to me. Any ideas, what might be wrong?


#2

look at the parentheses at the line above the error


#3

Thanks :slight_smile:


#4