From defd7d31961ba948b008b4feed38ab3d39481cba Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sat, 14 May 2022 16:06:10 +0800 Subject: [PATCH] save project --- __pycache__/func.cpython-37.pyc | Bin 0 -> 531 bytes func.py | 22 ++++++++++++++++++++++ tiaoshuibisai.py | 5 +++++ 3 files changed, 27 insertions(+) create mode 100644 __pycache__/func.cpython-37.pyc create mode 100644 func.py create mode 100644 tiaoshuibisai.py diff --git a/__pycache__/func.cpython-37.pyc b/__pycache__/func.cpython-37.pyc new file mode 100644 index 0000000..d95f85b 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..1dedbe8 --- /dev/null +++ b/func.py @@ -0,0 +1,22 @@ +total = [] +def a(): + while True: + + unit= (input("请输入:")) + if unit=='q': + break + else: + try: + unit=int(unit) + except: + print("请输入整数") + else: + total.append(unit) + #print(total) + return total +def sum(money): + sum=0 + for i in money: + sum+=i + return sum +# print(sum(a())) diff --git a/tiaoshuibisai.py b/tiaoshuibisai.py new file mode 100644 index 0000000..3c8ef48 --- /dev/null +++ b/tiaoshuibisai.py @@ -0,0 +1,5 @@ +import func + +data=func.a() +score=func.sum(data) +print("这位选手的得分是"+str(score)) \ No newline at end of file -- libgit2 0.25.0