I can't understand syntax error in this code. Please help me understand what went wrong in the line 5 of this code. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I can't understand syntax error in this code. Please help me understand what went wrong in the line 5 of this code.

TargetGuess = 25 i = 4 while i>0 or i == 0: guess = int(input('Please enter your guess.you have 5 guesses left: ') i=i-1 if guess == TargetGuess: print('You Won!......you have guessed it rightly.Congratulations!') elif guess < TargetGuess: print('oops.your guess is lower than the actual number. Guess again: ') elif guess > TargetGuess: print('oops.your guess is greater than the actual number. Guess again: ') print('You have ',i+1,'guesses left')

19th Jun 2020, 2:18 PM
Robin Sain
Robin Sain - avatar
3 Answers
+ 5
You didn't close the bracket adequately on line 4. There are two opening brackets there but only single closing one.
19th Jun 2020, 2:23 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 2
Robin Sain You close the input's brackets but forgot to close int's brackets... :)
19th Jun 2020, 2:26 PM
Indira
Indira - avatar
0
Thank you so much for replying so fast.
19th Jun 2020, 2:48 PM
Robin Sain
Robin Sain - avatar