question on "input"

b83503104 at yahoo.com b83503104 at yahoo.com
Tue Jul 12 10:31:47 EDT 2005


Hi,

I want to accept the user's answer yes or no.
If I do this:

answer = input('y or n?')

and type y on the keyboard, python complains

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "<string>", line 0, in ?
NameError: name 'y' is not defined

It seems like input only accepts numerals, or strings with quotes.
Need solutions, thanks.




More information about the Python-list mailing list