Commit 32baed38 by BellCodeEditor

save project

parent f31eac19
Showing with 12 additions and 2 deletions
def price(): def price():
total=[] total=[]
while True: while True:
unit=(input()) unit=input()
if unit=="q": if unit=="q":
break break
else: else:
unit=int(unit)
total.append(unit) total.append(unit)
print(total) print(total)
return price() return total
try: try:
a=price() a=price()
...@@ -15,6 +16,15 @@ except: ...@@ -15,6 +16,15 @@ except:
print("数据类型错误") print("数据类型错误")
else: else:
print(a) print(a)
def sum(i):
count=0
for f in i:
count=count+f
return count
b=sum(a)
b=str(b)
print("消费"+b)
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