Commit af68555b by BellCodeEditor

save project

parent 3b393db7
Showing with 11 additions and 9 deletions
total = []
while True:
unit= input("请输入:")
if unit== 'q':
break
else:
total.append(unit)
print(total)
\ No newline at end of file
def new_input():#定义一个新函数
total = []#创建一个变量存放价格
while True:#无限循环
unit= input('请输入(q退出):')#输入的内容赋值给unit这个变量
if unit== 'q':#如果输入的内容失q的话
break#终止程序
else:#否则
total.append(unit)#将输入的价格追加到total价格列表中
print(total)#打印价格的列表
new_input()#调用函数
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment