Commit 3439c28b by BellCodeEditor

auto save

parent 05e7d622
import func
a=func.b()
b=func.c(a)
print(b)
\ No newline at end of file
def b():
total = []
while True:
unit= input("请输入:")
if unit== 'q':
break
else:
try:
unit=int(unit)
except:
print("输入错误")
else:
total.append(unit)
return total
def c(d):
e=0
for i in d:
e=e+i
return e
'''
f=b()
g=c(f)
print("一共消费了"+str(g)+"元。")
'''
\ 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