Your own while else


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!"

print "You lose."

if guess==random_number:
i kept on having a syntex problem on this line.
can i get some advice?


The line above isn't finished, it doesn't make sense to start another line - so it's a syntax error


Did you ever figure this one out? I'm getting the exact same error as you were.


in your code: guess = int(raw_input("Your guess:") --> here should come another bracket, unless it won't work, because the code isn't finished


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.