So, I'm making a text based puzzle game using Python for my programming class (we are forced to use python), so instead of having the user say something simple like 1 or 2, I want the program to detect if the user has entered something like 'Hesitate' or 'Walk' exactly.
Currently I have it determine the amount of characters in the user's input, however this makes it possible for them to input almost anything.
#Choice Number1
def introchoice():
print("Do you 'Hesitate? or do you 'Walk forward")
def Hesitate():
print()
print("You hesistate, startled by the sudden illumination of the room. Focusing on the old man who has his back turned to you. He gestures for you to come closer. \n ''Come in, Come in, don't be frightened. I'm but a frail old man'' he says.")
print()
#
def Walk():
print()
print("DEFAULT")
print()
#Currently Determines Input
InputVar = 5
#User Input
Choice = str(input())
#Checks length
if len(Choice) >= InputVar:
Hesitate()
else:
if len(Choice) <= InputVar:
Walk()
else:
print("Invalid Input")
#Intro Choice Def end
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
#Clean Up
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
How can I change this so If the input is anything but Walk or Hesitate it wont take the input (in this current code, Walk is not included in the code yet). I want it to be something like;
if input = "Hesitate"
print("You Hesitate")
else:
if input = "Walk"
print("You walk forward")
else:
print("Invalid Input")
I can't figure out how I can properly do this in python. I honestly searched everywhere.