我正在制作文字冒险游戏,我试图让用户使用q退出游戏。我不知道输入什么,这是我的代码。
print ("Welcome to Camel!")
print ("You have stolen a camel to make your way across the great Mobi deset.")
print ("The natives want their camel back and are chasing you down! Survive your desert trek and out run the natives.")
print ("Welcome to Camel!")
print ("You have stolen a camel to make your way across the great Mobi deset.")
print ("The natives want their camel back and are chasing you down! Survive your desert trek and out run the natives.")
done = False
while done == False:
print("Print the letter only.")
print("A. Drink from your canteen.")
print("B. Ahead moderate speed.")
print("C. Ahead full speed.")
print("D. Stop for the night.")
print("E. Status check.")
print("Q. Quit.")
first_question = input("What do you want to do? ")
if first_question.lower() == "q":
done = True
if done == True:
quit
这些行在代码中都正确缩进(网站在复制粘贴时会很奇怪)。任何帮助表示赞赏。
答案 0 :(得分:0)
答案 1 :(得分:-2)
print ("Welcome to Camel!")
print ("You have stolen a camel to make your way across the great Mobi deset.")
print ("The natives want their camel back and are chasing you down! Survive your desert trek and out run the natives.")
done = False
while done == False:
print("Print the letter only.")
print("A. Drink from your canteen.")
print("B. Ahead moderate speed.")
print("C. Ahead full speed.")
print("D. Stop for the night.")
print("E. Status check.")
print("Q. Quit.")
first_question = input("What do you want to do? ")
if first_question.lower() == "q":
done = True
if done == True:
break
现在,当您输入“Q”或“q”时,程序将退出。 这是关于制表的。那是你问的吗?