From 959350df09adbf1823659aa34c8223160e36afa0 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sat, 6 Apr 2024 17:44:55 +0800 Subject: [PATCH] save project --- __pycache__/func.cpython-37.pyc | Bin 0 -> 567 bytes func.py | 20 ++++++++++++++++++++ sehu.py | 4 ++++ 3 files changed, 24 insertions(+) create mode 100644 __pycache__/func.cpython-37.pyc create mode 100644 func.py create mode 100644 sehu.py diff --git a/__pycache__/func.cpython-37.pyc b/__pycache__/func.cpython-37.pyc new file mode 100644 index 0000000..ffde457 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..e8e0ddf --- /dev/null +++ b/func.py @@ -0,0 +1,20 @@ +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=count+i + return count + print(total) \ No newline at end of file diff --git a/sehu.py b/sehu.py new file mode 100644 index 0000000..0ac9a69 --- /dev/null +++ b/sehu.py @@ -0,0 +1,4 @@ +import func +data=func.new_input() +score=func.sum(data) +print("这位选手的总分数为:"+str(score)) -- libgit2 0.25.0