How can I loop back to the beginning, when my player chooses option 2 or 3? I have tried to loop, but I don’t know where I can set the while loop, and start to move from the beginning. In other words, restart the game.
and here's my code, but it's not working properly
print ("You are an office worker. You just ended your overnight shift, where you are the only one left in the building. Before leaving, you decide to go to the washroom to do your business. While washing up, you spot a white figure in the mirror. As you looked closely in the mirror, you then realize that a ghost has been hovering over you.")
print ("After realizing that there was a ghost hovering over you, what would you do?")
sc1Option1=print("[1]RUN")
sc1Option2=print("[2]HIDE")
sc1Option3=print("[3]PEEK")
print("")
Option=input("Choose your Option!")
if (Option=="1"):
sc1Option1=print("Run")
elif (Option=="2"):
print("Sorry,hiding will not help you to escape.Please restart.")
elif (Option=="3"):
print("Sorry,peeking will not help you escape.")
what I'm trying to do is:
if the player chooses option 1 - the program will go to the next scenario.
if the player chooses option 2 - the program will show the text "Sorry, hiding will not help you to escape.Please restart." first, and back to the beginning.
if the player chooses option 3 - the program will show the text "Sorry, peeking will not help you escape." first, and let the player re-choose the option again.
What I have tried:
I have tried to loop, but I don’t know where I can set the while loop, and start to move from the beginning. In other words, restart the game.