Commit 0c4ef9b6 by BellCodeEditor

save project

parent bcc9d2ad
Showing with 14 additions and 3 deletions
def ab(): def ab():
total = [] total = [] #保存价格
while True: while True:
unit=input("请输入(q退出):") unit=input("请输入(q退出):")
if unit =="q": if unit =="q":
break break
...@@ -14,6 +13,18 @@ def ab(): ...@@ -14,6 +13,18 @@ def ab():
total.append(unit) total.append(unit)
finally: finally:
print("-"*30) print("-"*30)
return total return total #返回价格列表
result=ab() result=ab()
print(result) print(result)
def sum(money):
cont=0
for i in money:
cont+=i
return cont
print(sum(result))
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