我是否正在尝试创建一个寄存器,该寄存器将用户输入附加到列表中,中断并返回到用户“输入数据”的提示,但仅在输入字符串“done”时停止。
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)
答案 0 :(得分:0)
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)