diff --git a/func.py b/func.py new file mode 100644 index 0000000..fefd817 --- /dev/null +++ b/func.py @@ -0,0 +1,23 @@ +def new_input() : + total = [] + while True: + money=input("请输入(q退出):") + if money== 'q': + break + else: + try: + money=int(money) + except: + print("请重新输入一个数字") + else: + total.append(money) + finally: + print("="*30) + return total +result=new_input() +print(result) +def sum(money): + count=0 + for i in money(): + count=count+i + return count \ No newline at end of file