All. I am a bit new to Python. I have recently taken a course and followed a few tutorials. I am trying to explore on my own and just make "something". This is for a texted-based RPG. I am trying to read the users input from a pre-existing list I already created in case they type the choices a different way.
right_Choices = ["right", "Right", "RIGHT"]
left_Choices = ["left", "Left", "LEFT"]
Later in the code I ask the user which direction they would like to go in "left or right?" After their input I am trying to have the code understand any of the possible inputs i.e if they input "left" first then later on input "LEFT" or "Left" it will still continue to understand.
# Check user input for left or right
left_or_right = input("You wake up dazed in a random alley... Unsure of where you are, which way will you go? Left or Right? ")
#Left option
if left_or_right == left_Choices:
ans = input("You stumble into a saloon nearly empty but some faces are there. Feel like having a drink at the bar? Or sitting at an empty table? (bar/table)? ")
if ans == "bar":
print("You sat at the bar and the bartender slides a glass across On the house partner! Nice! A free drink to help out. (+10HP)")
health +=10
elif ans == "table":
print("You sit at an empty table and a group on men approach and seat themselves So tough guy where's our 450Gold!?")
else:
print("You were too drunk to walk, fell down and passed out...")
I hope my explanation is at least a bit understandable because I am pretty new to this and I am not sure how to word this question.
x)