In python 2, raw_input
will return a string while input
will return an evaluated string. Therefore input
works fine for the numbers, since eval('2')
gives 2
(as an integer). However it does not work for the name, and hence eval("John")
throws an error.
I would recomment to use raw_input
throughout your code.
For the numbers you may then compare to a string
if nameless_variable_1 == "2":
and for the name it will not throw an error.
1
solved How to input a player name?