From f84a81569180c230ffa9a667d30c26537582894f Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sun, 21 Apr 2024 17:16:20 +0800 Subject: [PATCH] save project --- func.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 func.py diff --git a/func.py b/func.py new file mode 100644 index 0000000..306c913 --- /dev/null +++ b/func.py @@ -0,0 +1,24 @@ +def func(): + total = [] + while True: + try: + unit= int(input("请输入:")) + except: + print("请输入整数") + else: + if unit==0: + break + else: + total.append(unit) + print(total) + return total + +def jisuan(total): + count = 0 + for i in total: + count = count + i + return count + +abc = func() +jiage = jisuan(abc) +print(jiage) -- libgit2 0.25.0