From 9105c14c0748be13aee7ef3fd1221a3df2dd9073 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sat, 10 Apr 2021 15:03:40 +0800 Subject: [PATCH] save project --- func.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 func.py diff --git a/func.py b/func.py new file mode 100644 index 0000000..4afa7b8 --- /dev/null +++ b/func.py @@ -0,0 +1,21 @@ +def new_input(): + total = [] + while True: + unit= input("请输入:") + if unit== 'q': + break + else: + try: + unit=int(unit) + except: + print("输错了,再来") + else: + total.append(unit) + return total + +def qiuhe(a): + sum=0 + for i in a: + sum+=i + return sum +print(qiuhe(new_input())) -- libgit2 0.25.0