Commit af16640d by BellCodeEditor

save project

parent 29241d6b
Showing with 11 additions and 10 deletions
......@@ -5,18 +5,19 @@ def new_input():
try:
unit=int(unit)
except:
total.append(unit)
else:
if unit== 'q':
break
else:
print('输入错误,请重新输入一个数字')
else:
total.append(unit)
return total
def sum(m):
for i in total:
m=m+i
return sum(m)
new_input()
a=sum(m)
print(a)
print("您一共消费了"+a+'元!')
\ No newline at end of file
a=0
for i in m:
a=a+i
return a
l=new_input()
print(l)
print(sum(l))
print("您一共消费了"+str(sum(l))+'元!')
\ 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