0
elif statement
num = input("enter the number ") 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") OUTPUT; enter the number 5 ##press enter Number isn't 5, 11 or 7 Why can anyone help me please
4 ответов
+ 5
For the first line... Do it like this
num = int(input("enter the number"))
You are comparing a string to an int so it will not give the desired output.
+ 6
Try this.
num=int(input("Enter the number "))
Because input gives by the user is always string in the input function whether user input is alphabet or digit.so you need to convert it into an integer.
+ 4
Input is a string.
"5" != 5
You would need either convert the input to integer or convert the compared values 5, 11, 7 to strings "5", "11", "7"
+ 2
thank you bro its working now