Commit fed61f1b by BellCodeEditor

auto save

parent cb3617f6
Showing with 15 additions and 12 deletions
def new_input():
total = []
while True:
unit= input("请输入:")
if unit== 'q':
unit = input("请输入:")
if unit == 'q':
break
else:
try:
total.append(int(unit))
except:
print("请输入一个整数")
print("请输入一个数字!")
return total
def sum(money):
count = 0
for i in money:
count = count + i
return count
def sum(list1):
sum = 0
for i in list1:
sum = sum + i
return sum
list1 = new_input()
s = sum(list1)
print('总共消费了:'+str(s) + '元')
a = new_input()
c = sum(a)
print(c)
\ 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