好吧,我编码的口袋妖怪文本冒险类游戏,我需要while循环的帮助。我已经完成了while循环部分。但不工作的部分是:你可以在选择两个raw_inputs run,battle之间进行选择。当您按下其中任何一个时,它不会显示消息。它所做的就是重复我编写它的问题。问题问:“你想跑或战Yveltal?”。您可以在ipython会话中输入“运行”或“对战”。当你键入战斗时,它应该说“你挑战Yveltal参加一场战斗!”。当你键入run时,它应该说“你不能跑你胆小鬼”,但如果你输入任何东西,它所要做的就是问同样的问题“你想跑步还是战斗Yveltal?”。我想要帮助的是离开while循环,当你输入run或battle时,它会显示该命令的消息。这是代码,我可以使用任何人的帮助,谢谢!Python口袋妖怪游戏虽然循环
from time import sleep
def start():
sleep(2)
print "Hello there, what is your name?"
name = raw_input()
print "Oh.. So your name is %s!" % (name)
sleep(3)
print"\nWatch out %s a wild Yveltal appeared!" % (name)
sleep(4)
user_input = raw_input("Do you want to Run or Battle the Yveltal?" "\n")
while raw_input() != 'Battle' or user_input == 'battle' != 'Run' or user_input == 'run':
print("Do you want to Run or Battle the Yveltal? ")
if user_input == 'Battle' or user_input == 'battle':
print("You challenged Yveltal to a battle!")
elif user_input == 'Run' or user_input == 'run':
print("You can't run you coward!")
那么,这是什么问题? – Arman