My code is as follows:
else:
print("that is incorrect!")
choice = input("Would you like to (g)uess again, or (q)uit? ")
if choice == "g":
guess == input("What animal is this? ")
elif choice == "q":
game_running = False
else:
print("That is not a valid option")
choice = input("Would you like to (g)uess again, or (q)uit? ")
When I run it, it returns the following for input = g, q, or anything else.
Traceback (most recent call last):
File "Project1.py", line 102, in <module>
choice = input("Would you like to (g)uess again, or (q)uit? ")
File "<string>", line 1, in <module>
NameError: name 'g' is not defined
I have used this format of evaluating a user guess several times before, and have never had any issues. Any suggestions would be greatly appreciated! I am running pygame on a Mac OSX, and I set python off python3 to allow pygame to work more effectively. I have added:
from __future__ import division, absolute_import, print_function, unicode_literals
to make python able to use python3 functionality.