1

I'm trying to make a script based story inspired by Black Mirror: Bandersnatch. This is my first time using Python or any other scripting programs so I'm REALLY bad. This is what I wrote:

  print("Hello! I'm your personal A.I. ")
q1 = input("Are you sure you want to begin this journey? (yes/no)")
if not q1 == "yes":
    print("Okay. Have a nice day")
    exit()
if q1 == "yes":
    print("You have chosen to begin this journey. Do not be sure you will make it to the end.")
    from time import sleep
    sleep(5)
    print(

    )
    print("You are in an old house. It's dark. You look around.")
c1 = ("There is a dirty window to your left. "
      )
c2 = ("In front of you there is a door. Light is coming from underneath."
      )
c3 = ("There is also a staircase to your right."
      )
q2 = input("Which one do you choose to go to? (window/door/staircase)")
if q2 == "window":
    print("You go over to the window. You try to look out but you can't see anything."
          )
    print("You go back")

This is where I need help. I need to return to c1 and start over the question. How do I do this?

1 Answers1

0

Try something like this. It will repeat your question until you input something else instead, in this case, 'window'. Just write logic for other options.

while True:
    q2 = input("Which one do you choose to go to? (window/door/staircase)")
    if q2 == "window":
        print("You go over to the window. You try to look out but you can't see anything."
          )
        print("You go back")
        continue
    else:
        break

when comes to continue it will proceed again from start of the while loop. And...when it comes to break, it will go out from the loop. simple as that