Can't understand what python wants from me

Chris Rebert clp2 at
Thu Jan 29 23:25:54 CET 2009

On Thu, Jan 29, 2009 at 1:50 PM, Oleksiy Khilkevich
<grim at> wrote:
> Hello, everyone,
> This may be a totally noob question, but since I am one, so here is it.
> I have the following code (not something much of):
> The current code runs well, but the problem is with input value:
> Аs you can see, the numbers are ok, but strings and characters cause "not
> defined" error.
> I've obviously missing something important, but tutorial says nothing about
> this.

You're using input(). You should be using raw_input(), at least until
everyone switches to Python 3.0 (which confusingly renames raw_input()
to input() because of the exact newbie confusion you're encountering).
raw_input() reads a string from stdin. input() call raw_input() and
then eval()-s the string, hence 'asd' gets interpreted as a variable,
which doesn't exist in your program, hence the error.

For further information, use help() on input and raw_input from the
interactive interpreter REPL.


Follow the path of the Iguana...

More information about the Python-list mailing list