无法弄清楚如何在 Python3 中重复流程
Cannot figure out how to repeat processes in Python3
我制作游戏是出于爱好,一种基于冒险文字的游戏。我无法弄清楚 id 是如何做到的,所以如果他们键入 "Get up" 以外的任何内容,该过程将重复进行,并且代码会反复询问他们,直到他们得到正确的答案。
getup = input("What is your action?: ")
if getup == "Get Up":
print("You stand up and get your bearings. You scan the enviroment. There is a small passage way to the north, and tight crevis to the east. Everywhere else is just cave wall")
elif getup == "get up":
print("You stand up and get your bearings. You scan the enviroment. There is a small passage way to the north, and tight crevis to the east. Everywhere else is just cave wall")
elif getup == "Get up":
print("You stand up and get your bearings. You scan the enviroment. There is a small passage way to the north, and tight crevis to the east. Everywhere else is just cave wall")
elif getup == "GET UP":
print("You stand up and get your bearings. You scan the enviroment. There is a small passage way to the north, and tight crevis to the east. Everywhere else is just cave wall")
else:
print("Celsia: You do not have time to waste,",name,"!!. You must Get Up")
也许使用 while
循环:
getup = input("What is your action?: ")
while getup.lower()!='get up':
print("Celsia: You do not have time to waste,",name,"!!. You must Get Up")
getup = input("What is your action?: ")
print("You stand up and get your bearings. You scan the enviroment. There is a small passage way to the north, and tight crevis to the east. Everywhere else is just cave wall")
我制作游戏是出于爱好,一种基于冒险文字的游戏。我无法弄清楚 id 是如何做到的,所以如果他们键入 "Get up" 以外的任何内容,该过程将重复进行,并且代码会反复询问他们,直到他们得到正确的答案。
getup = input("What is your action?: ")
if getup == "Get Up":
print("You stand up and get your bearings. You scan the enviroment. There is a small passage way to the north, and tight crevis to the east. Everywhere else is just cave wall")
elif getup == "get up":
print("You stand up and get your bearings. You scan the enviroment. There is a small passage way to the north, and tight crevis to the east. Everywhere else is just cave wall")
elif getup == "Get up":
print("You stand up and get your bearings. You scan the enviroment. There is a small passage way to the north, and tight crevis to the east. Everywhere else is just cave wall")
elif getup == "GET UP":
print("You stand up and get your bearings. You scan the enviroment. There is a small passage way to the north, and tight crevis to the east. Everywhere else is just cave wall")
else:
print("Celsia: You do not have time to waste,",name,"!!. You must Get Up")
也许使用 while
循环:
getup = input("What is your action?: ")
while getup.lower()!='get up':
print("Celsia: You do not have time to waste,",name,"!!. You must Get Up")
getup = input("What is your action?: ")
print("You stand up and get your bearings. You scan the enviroment. There is a small passage way to the north, and tight crevis to the east. Everywhere else is just cave wall")