【发布时间】:2016-04-02 18:38:09
【问题描述】:
我对 python 很陌生,我正在尝试通过制作一个简单的游戏来学习。我希望用户能够输入他们的动作,然后如果他们选择不继续,他们将被送回再次输入阶段。我已尽我所能尝试过,但一旦他们选择不“继续”,他们就无法再选择我提出的任何其他选项。
感谢您的帮助。
print ("How do you proceed?")
print ("Do you Shout? Look? Continue?")
action1 = input()
if action1 == ("Continue"): #Continue to next section
print ("You continue on throught the darkness untill you reach a cold stone wall")
pass
elif action1 == "Shout":
print ("In the dark noone can hear you scream.")
elif action1 == ('Look'):
print ("'I cannae see anything in the dark' you think to yourself in a braod Scottish accent.")
while action1 != ("Continue"):
print ("Enter your next action.(Case sensitive!!)")
print ("Shout? Look? Continue?")
action1 = input() #Want this too loop back to start of action menu
【问题讨论】:
标签: python loops if-statement while-loop