0

How can I have a multiple choice question with each answer a different response and a default answer for an answer that is not understandable?

I am trying to create a game where you use your imagination to complete the game.

I also need to somehow repeat until the correct answer is given.

Here is the code:

answer = input("start?")

while answer.lower() != "start":
    answer = input("type start")

else:
    print("starting")

answer = input("you find yourself in a car")

while answer != "["look", "get out"]:
    print("I don't understand..")
    answer = input("Try again")
else:
    if answer == "look":
        print ("looking")
    elif answer == "get out":
        print("got out of car")

print("finished")
Martin Evans
  • 45,791
  • 17
  • 81
  • 97
LAMagix
  • 1
  • 1
  • 2
    What's your question? What problems did you face? – Querenker Feb 19 '17 at 14:50
  • 2
    Possible duplicate of [Asking the user for input until they give a valid response](http://stackoverflow.com/questions/23294658/asking-the-user-for-input-until-they-give-a-valid-response) – timgeb Feb 23 '17 at 07:09
  • Have a look at `while answer != "["look", "get out"]`. Are you sure that's what you want? (It's not.) – timgeb Feb 23 '17 at 07:10
  • My problem is that I would like to have a different response based on the input and then loop a different question until the original answer is given. The program asks "start" – LAMagix Feb 24 '17 at 14:35

0 Answers0