Simple answer - this code is intended to run on python3 and you are running it on python2. As you are new to python - install python3 and use it, not python2. Support for python2 will end soon.
The reason behind the problem - in python2 one should use
In python3
The reason behind the problem - in python2 one should use
raw_input()
instead of input()
. In python2 input()
evaluates the user input as if it is valid python code, while raw_input()
just returns user input as string.In python3
input()
returns user input as string, so it is equivalent to raw_input()
in python2.