My code looks like this
def title_screen_selections():
option = input()
if option.lower() == ("play"):
start_game()
if option.lower() == ("help"):
instruction_menu()
if option.lower() == ("quit"):
sys.exit()
while option.lower() not in ['play', 'help', 'quit']:
print("Please enter a valid command.")
option = input("> ")
if option.lower() == ("play"):
start_game()
if option.lower() == ("help"):
instruction_menu()
if option.lower() == ("quit"):
sys.exit()
when I type
python filename.py
into terminal, it displays the title screen. When I try to type play, it gives me
Traceback (most recent call last):
File "game.py", line 272, in <module>
title_screen()
File "game.py", line 270, in title_screen
title_screen_selections()
File "game.py", line 218, in title_screen_selections
option = input()
File "<string>", line 1, in <module>
NameError: name 'play' is not defined
When I type 'play' with single or double quotes, it works fine. Any suggestions? I'm relatively new to python