while True
game2=input("Welcome to Treasure island! Your mission is to find the treasure. You find two different paths. Left or Right?")
if str(game2)==str("right"):
print("GAME OVER! You fell down a hole")
elif str(game2)==str("left"):
print("CONGATULATIONS! You made it")
print("You are being chased by an angry mob of monkeys. What do you do? Give them a banana or hide?")
if str(game2)==str("give them a banana"):
print("GAME OVER! You didnt have enough bananas")
elif str(game2)==str("hide"):
print("CONGRATULATIONS! You made it")
print("You found an old abandond cabin. Do you go in?")
if str(game2)==str("no"):
print("GAME OVER! You were eaten by a hungry bear")
elif str(game2)==str("yes"):
print ("CONGRATULATIONS! You got away from the forest")
print("You find three doors 1,2,and 3. Which do you pick?")
if str(game2)==str("1"):
print("GAME OVER! You fell into a dark pit")
elif str(game2)==str("3"):
print("GAME OVER! The room was filled with toxic gas")
elif str(game2)==str("2"):
print("You chose the right door")
print("You found a dark room with three treasure chests inside. You can only open one. Which do you pick 1,2,or 3?")
if str(game2)==str("3"):
print("GAME OVER! The treasure chest was filled with spiders")
elif str(game2)==str("2"):
print("GAME OVER! You opened an empty treasure chest")
elif str(game2)==str("1"):
print ("CONGRATS, YOU FOUND THE TREASURE!!")
Первый вопрос обычно возникает сам по себе, затем остальные вопросы приходят вместе. Я попытался удалить цикл while true, но он все равно работает вместе. Когда я добавляю else, оно тоже печатается.
[code]while True game2=input("Welcome to Treasure island! Your mission is to find the treasure. You find two different paths. Left or Right?") if str(game2)==str("right"): print("GAME OVER! You fell down a hole") elif str(game2)==str("left"): print("CONGATULATIONS! You made it") print("You are being chased by an angry mob of monkeys. What do you do? Give them a banana or hide?") if str(game2)==str("give them a banana"): print("GAME OVER! You didnt have enough bananas") elif str(game2)==str("hide"): print("CONGRATULATIONS! You made it") print("You found an old abandond cabin. Do you go in?") if str(game2)==str("no"): print("GAME OVER! You were eaten by a hungry bear") elif str(game2)==str("yes"): print ("CONGRATULATIONS! You got away from the forest") print("You find three doors 1,2,and 3. Which do you pick?") if str(game2)==str("1"): print("GAME OVER! You fell into a dark pit") elif str(game2)==str("3"): print("GAME OVER! The room was filled with toxic gas") elif str(game2)==str("2"): print("You chose the right door") print("You found a dark room with three treasure chests inside. You can only open one. Which do you pick 1,2,or 3?") if str(game2)==str("3"): print("GAME OVER! The treasure chest was filled with spiders") elif str(game2)==str("2"): print("GAME OVER! You opened an empty treasure chest") elif str(game2)==str("1"): print ("CONGRATS, YOU FOUND THE TREASURE!!") [/code] Первый вопрос обычно возникает сам по себе, затем остальные вопросы приходят вместе. Я попытался удалить цикл while true, но он все равно работает вместе. Когда я добавляю else, оно тоже печатается.