func.py
495 Bytes
def new_input():
total = []
while True:
try:
unit=input("请输入:")
a=int(unit)
except:
if unit == 'q':
break
else:
print("请输入整数")
else:
if unit== 'q':
break
else:
total.append(a)
return total
def sum(money):
count = 0
for i in money:
count += i
return count
#a=sum(new_input())
#print(a)