20
Jan
2012
Python: error when using the input() function
By Eric Downing. Filed in Programming, Scripting |I was writing a basic guessing game and when I tried to take user input I was
getting the following:
Code:
guess = input() d
Error:
Traceback (most recent call last): File "", line 1, in File " ", line 1, in NameError: name 'd' is not defined
The problem is actually with the version of Python that I was using. If you
are using Python 2.x, you need to use the raw_input() function. And with 3.x
you can use the input() function.