Need some help with the If statement code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Need some help with the If statement code

For the below code even if i enter output as 5, 7 or 10 it shows as number isnt 5, 7 or 11?? num = input() if num == 5: print("Number is 5") else: if num == 11: print("Number is 11") else: if num == 7: print("Number is 7") else: print("Number isn't 5, 11 or 7")

22nd Dec 2019, 7:20 PM
Yash Kapor
1 Answer
+ 1
num has a string type. Try this: num = int(input())
22nd Dec 2019, 7:29 PM
Игорь Яковенко
Игорь Яковенко - avatar