I have written a menu that runs before I am testing it will only run the first if
and not any of the following elif
lines.
An example being when asked to make my input in the first question in the menu, if I type exit (or any capitalised variation) it will output 'Goodbye' as expected and stop running but if I type in 'color', 'colour', 'play' or make an invalid entry nothing happens and the script stops running.
print("Python Adventure\n")
def menu(): # This is the menu text for options before running the game
option_1 = input("Select an option:\nPlay Color Exit\nType:")
if option_1.lower() == "exit":
print("\nGoodbye")
exit()
elif option_1.lower() == "color" or "colour": # color options here
def color():
color_1 = input("Play with color? yes/no\nType:")
if color_1.lower() == "n" or "no":
print("Color off\n")
menu()
elif color_1.lower() == "y" or "yes":
print("Color on\n")
menu()
elif color_1.lower() != "":
print("Not recognised please try again.")
color()
color()
elif option_1.lower() == "play": # Text based game will start here.
print("Running: Python Woods")
elif option_1.lower() != "": # Invalid entry trigger.
print("Invalid entry, try again.")
menu()
menu()
Please feel welcome to correct me on any terminology and formatting too. Any learning is helpful.