Why does it keep saying that else: syntax is wrong?
It seems fine but I'm stuck.
else should be after
while, its currently after you update a variable
Thanks for answering
Yeah I tried placing the variable'guesses_left' after the else condition and it's showing error
The variable was placed after the else condition.
Here's the result after execution
why place it after else? The user loses after they are out of guesses (which is after the loop is finished running)
I know, But if Iam placing it after if and above else. It's showing error. The first image
but you want to get
while/else, since you want else to run when the user runs out of gueses
Hey thanks for answering. it solved my problem.All along I was trying for if/else.My bad
while guesses_left > 0:
if guess == random_number:
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.