[Tutor] Help
Steven D'Aprano
steve at pearwood.info
Tue May 15 20:51:22 EDT 2018
On Tue, May 15, 2018 at 02:49:54PM -0500, Sam Hoffman wrote:
> Traceback (most recent call last):
> File "/Users/samhoffman/Documents/test.py", line 54, in <module>
> Battle()
> File "/Users/samhoffman/Documents/test.py", line 41, in Battle
> Move = input('What Will You Do? Fight or Run: ')
> File "<string>", line 1, in <module>
> NameError: name 'Run' is not defined
You need to either define a value for Run:
Run = 2468
or you need to quote it, making it a string. Same applies to your Fight:
> if Move == Fight:
> pass
> elif Move == Run:
Both of these ought to be "Fight" and "Run" in quotes.
You also seem to be using Python 2. In Python 2, you should never use
the input() function. Instead, use raw_input() instead.
--
Steve
More information about the Tutor
mailing list