Commit 9d565cda by BellCodeEditor

save project

parent dc70412a
Showing with 31 additions and 0 deletions
def totl():
total = []
while True:
unit= input("请输入价格:")
if unit== 'q':
break
else:
try:
unit=int(unit)
except:
print("你输入的不是整数")
else:
total.append(unit)
return total
def sum(qw):
ars=0
for i in qw:
ars=ars+i
return ars
totpl=totl()
a=sum(totpl)
print(a)
\ 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