为什么要输入两次quit才结束,本意是在第一次输入quit时就结束程序
好像没问题。
sentence = "\n please enter the city you have visited:"
sentence += "\n enter 'quit' when u finisih."
while True:
city=input(sentence)
citys=['new york', 'shanghai', 'beijing' , 'chongqing', 'guangzhou']
if city.lower() in citys:
print(city)
elif city=='quit':
break
你不是第一个quit打上空格了?
每次运行都是这样?