[Tutor] Help

Alan Gauld alan.gauld at yahoo.co.uk
Wed May 16 03:55:43 EDT 2018

On 16/05/18 02:43, Steven D'Aprano wrote:

> The traceback Sam posted says (in part):
>   Move = input('What Will You Do? Fight or Run: ')
>   File "<string>", line 1, in <module>
>   NameError: name 'Run' is not defined
> so the failed line was the call to input(). In Python 3, it would return 
> a string. In Python 2, input() evaluates whatever the user types as 
> code, hence I infer Sam typed:
>     Run
> and input() tries to evaluate it, which fails.

I was trying to figure out why the traceback highlighted
that line instead of the if... I never thought about it
being a Python 2 issue.

Good catch!

Alan G
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:

More information about the Tutor mailing list