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