+ 1
num = input ("Please input 5 or 7 or 11 :") if num == 5: print("Number is 5") elif num == 11: print("Number is 11") elif
please I don't know why does not it work ? https://code.sololearn.com/cBqTmNuWSd4H/?ref=app https://code.sololearn.com/cBqTmNuWSd4H/?ref=app
4 Answers
+ 10
This should work sir:
num = input("Please input 5 or 7 or 11 :")
num = int(num)
if num == 5:
print("Number is 5")
elif num == 11:
print("Number is 11")
elif num == 7:
print("Number is 7")
else:
print("Number isn't 5, 11 or 7")
The reason it didn't work is the input data type is string in default
+ 1
Nuber is 5
0
the input function returns a string, So we must convert it to integer.
0
hi