Commit d9852d2c by BellCodeEditor

auto save

parent dc70412a
def new_input():
total = []
while True:
money = input('请输入(q退出):')
if money == 'q':
break
else:
try:
money = int(money)
except:
print("请重新输入一个数字")
else:
total.append(money)
finally:
print("-"*30)
return total
result = new_input()
print(result)
import o
a=o.zong()
b=o.sum(a)
print(b)
print(a)
\ No newline at end of file
def zong():
a=[]
while True:
b=input("请输入价格(按q退出):")
try:
if b == "q":
break
else:
a.append(int(b))
except:
print("请输入数字")
finally:
print(20*"*")
return a
# d=zong()
# print("账单为",d)
def sum(e):
c=0
for i in e:
c=c+i
return c
# e=sum()
# print("总价为:",e)
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