+ 1

[SOLVED]Need help with this code. Somebody help me if you can

Here is the code: z = 7 y = 4 a = 3 j = 12 x = input() if x == 7: print("Correct! you choose z!") else: print("No") Program outputs "no", even if i write 7. How to fix this?

24th Sep 2020, 6:17 PM
Krot
2 Answers
+ 2
input() function accept input in the form of string.. So you need to convert to needed form by casting.. To cast to int do like this: x = int( input() )
24th Sep 2020, 6:44 PM
Jayakrishna 🇼🇳
0
Thanks
24th Sep 2020, 6:48 PM
Krot