From 3bfd107e0e7fa1718ede394019da2172a0738266 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sun, 5 Jun 2022 16:37:03 +0800 Subject: [PATCH] save project --- __pycache__/func.cpython-37.pyc | Bin 0 -> 541 bytes func.py | 22 ++++++++++++++++++++++ swim.py | 4 ++++ 3 files changed, 26 insertions(+) create mode 100644 __pycache__/func.cpython-37.pyc create mode 100644 func.py create mode 100644 swim.py diff --git a/__pycache__/func.cpython-37.pyc b/__pycache__/func.cpython-37.pyc new file mode 100644 index 0000000..a309b25 Binary files /dev/null and b/__pycache__/func.cpython-37.pyc differ diff --git a/func.py b/func.py new file mode 100644 index 0000000..c757b46 --- /dev/null +++ b/func.py @@ -0,0 +1,22 @@ +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 sum(money) : + count=0 + for i in money : + count+=i + return count +# list1= new_input() +# result=sum(list1) +# print(result) \ No newline at end of file diff --git a/swim.py b/swim.py new file mode 100644 index 0000000..f9ef8ec --- /dev/null +++ b/swim.py @@ -0,0 +1,4 @@ +import func +data = func.new_input() +int1 = func.sum(data) +print("该选手的总得分是"+str(int1)) \ No newline at end of file -- libgit2 0.25.0