Почему мой пользовательский ввод повторяет все вопросы? [закрыто]Python

Программы на Python
Ответить
Anonymous
 Почему мой пользовательский ввод повторяет все вопросы? [закрыто]

Сообщение Anonymous »

Код: Выделить всё

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, оно тоже печатается.

Подробнее здесь: https://stackoverflow.com/questions/790 ... -questions
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Python»