diff --git a/func.py b/func.py new file mode 100644 index 0000000..fef834d --- /dev/null +++ b/func.py @@ -0,0 +1,21 @@ +def new_input(): + total = [] + while True: + unit= input("请输入:") + if unit== 'q': + return total + else: + try: + asdf=int(unit) + except: + print("请输入整数") + else: + total.append(asdf) + +def sum(money): + count=0 + for i in money: + count=count+i + return count + +print(sum(new_input())) \ No newline at end of file