0

i cant find where's the mistake, please help

I want to make a code where if the answer is correct (which is 12 in this case) it should say 'Correct answer' if not then 'Incorrect answer' but i get 'Incorrect answer' both times. Que = input('What is 7+5 =') if Que == 12: print ('Correct answer') else: print ('Incorrect answer')

4th Dec 2021, 6:07 AM
Naveen
2 Réponses
+ 2
Don't pass anything inside input function. Also input () function returns String value so you need to make it int by casting with int function. que = int(input())
4th Dec 2021, 6:09 AM
A͢J
A͢J - avatar
+ 2
Naveen just put 12 of if condition in quotations (if Que == "12": )... Or Just convert Que to integer by int(Que)
4th Dec 2021, 7:58 AM
Sanjyot21
Sanjyot21 - avatar