+ 5
input() always returns a string.
If you want it to be an integer, you need to convert it.
+ 1
Your list only contains integer, there isn't any other type.
Suppose you had a list [1, "1"]. The user input is "1". How would you know if the user means 1 or "1"?
+ 1
Why do the numbers in the list need to be integers? You can store them as strings...
If not you need to convert it some way or the other.
+ 1
use typecasting..
userinput_ = int(input())
or,
userinput_ = input()
int(userinput_)
try this, once it will work
+ 1
'''
ice , or you can temporarily map all the elements to str in the if statement. Then you will be comparing string to string, not int to string.
It is not the append not working.It is because in your if statement, you are comparing string to int.
'''
userinput_ = input()
list = [1, 2, 3]
list.append("spam")
if userinput_ in map(str, list):
list.append("eggs")
print(list)
'''
input 1, 2 or 3 will append "eggs"
'''
0
As i slightly remember, GOTO keyword of C is used to position the cursor before printing out something on the screen. But now, i don't exactly remember tge syntax how to implement this C keyword GOTO. Is there anyone can help about this syntax. Thank you for those who will patiently answer.