From d8c9ba91a0806166dd7c4cdc85b0cada3f4b67ed Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sun, 21 Aug 2022 18:07:54 +0800 Subject: [PATCH] save project --- func.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 func.py diff --git a/func.py b/func.py new file mode 100644 index 0000000..a43ff80 --- /dev/null +++ b/func.py @@ -0,0 +1,23 @@ +def new_input(): + total = [] + while True: + unit= input("请输入:") + if unit== 'q': + break + else: + try: + unit=int(unit) + except: + print("请输入整数") + else: + total.append(unit) + print("-"*30) + return total +def sum(m): + count=0 + for i in m: + count=count+i + return c +p=new_input() +a=sum(p) +print(a) -- libgit2 0.25.0