В настоящее время я пишу текстовую игру, чтобы немного попрактиковаться в операторах if/elif, и у меня возникла проблема с выходом из операторов if/elif. Я хочу, чтобы он продолжился с исходного оператора if/elif, начиная с того места, где находится начальный оператор elif (последние две строки кода). Возможно ли это? Вот что у меня есть на данный момент:
cave_or_jungle = input("Do you go into the JUNGLE or the CAVE?").lower()
if cave_or_jungle == "cave":
print("You go into the cave! The cave is cold and dark. You find a rusty lantern and hear strange growling deeper inside.")
deeper_or_leave = input("Do you go DEEPER or LEAVE?").lower()
if deeper_or_leave == "deeper":
print("Deep in the cave, a giant beast jumps out of the darkness.")
fight_or_run = input("Do you FIGHT or RUN?").lower()
if fight_or_run == "fight":
print("The beast is too powerful. You are defeated.")
print("GAME OVER")
# Game ends
elif fight_or_run == "run":
print("You run back outside and follow the jungle path.")
# Exit statement here to continue onto line 47 below. Code now runs up to this statement and then stops.
elif deeper_or_leave == "leave":
print("You go back outside.")
# Exit statement here to continue onto line 47 below. Code now runs up to this statement and then stops.
elif cave_or_jungle == "jungle":
print("You are in the jungle!")
print("The jungle is thick and noisy. You hear water nearby and see smoke rising through the trees.")
input("Do you follow the RIVER or the SMOKE?")
# Have previous two elif statements run to this elif statement and progress with story.