在用户输入列表中满足条件时停止 while 循环
Stopping a while loop when a condition is met in a userinput list
拜托,我正在尝试创建一个寄存器,将用户输入、中断和 returns 附加到用户 "input data" 的提示中,但仅在字符串 [=14] 时停止=] 已输入。
userinput = input("Please Input price: ")
price = [userinput]
while True:
if price.append(userinput) is True:
print(price)
if price.append("done") is True:
break
print(price)
userinput = input("Please Input price: ")
price = []
while userinput != "done":
price.append(userinput)
print(price) # This appears to serve as debugging only, you will see the whole list as it is grown
userinput = input("Please Input price: ")
print(price)
拜托,我正在尝试创建一个寄存器,将用户输入、中断和 returns 附加到用户 "input data" 的提示中,但仅在字符串 [=14] 时停止=] 已输入。
userinput = input("Please Input price: ")
price = [userinput]
while True:
if price.append(userinput) is True:
print(price)
if price.append("done") is True:
break
print(price)
userinput = input("Please Input price: ")
price = []
while userinput != "done":
price.append(userinput)
print(price) # This appears to serve as debugging only, you will see the whole list as it is grown
userinput = input("Please Input price: ")
print(price)