0

NOT CONSIDERING PREVIOUS CASES

num=input("enter a num:") if num==5: print("5") elif num==11: print("11") elif num==7: print("7") else: print("nothing") *** WHY THE OUTPUT IS ALWAYS SHOWING "NOTHING" WHEN THE INPUT IS 5,7 OR 11?

26th Mar 2018, 8:07 AM
Aunkan Gomes
Aunkan Gomes - avatar
2 Respostas
+ 11
Because input() returns a string by default. Try: num = int(input("enter a num:")) and see what happens ;)
26th Mar 2018, 8:19 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 1
thanks sir
26th Mar 2018, 8:29 AM
Aunkan Gomes
Aunkan Gomes - avatar