From 4a248daea62c5b8c515b45f50218b647519661bd Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Wed, 27 Jul 2022 11:55:55 +0800 Subject: [PATCH] save project --- __pycache__/func.cpython-37.pyc | Bin 0 -> 750 bytes func.py | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ swim.py | 4 ++++ 3 files changed, 53 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..45a89fe 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..87b1836 --- /dev/null +++ b/func.py @@ -0,0 +1,49 @@ +def new_input(): + total = [] + while True: + unit=input('请输入q退出:') + if unit== 'q': + print("程序结束") + break + else: + + try: + unit= int(unit) + except: + print("请重新输入一个数字") + else: + total.append(unit) + finally: + print("_"*30) + return total +def sum(unit): + count=0 + for i in unit: + count=count+i + return count +price=new_input() +pay=sum(price) +print("您一共消费了"+str(pay)+"元!扫码还是现金呢?") + + + + + + + + + + + + + + + + + + + + + + + diff --git a/swim.py b/swim.py new file mode 100644 index 0000000..b3f92bf --- /dev/null +++ b/swim.py @@ -0,0 +1,4 @@ +import func +data=func.new_input() +score=func.sum(data) +print("这位选手的总分数为:"+str(score)) \ No newline at end of file -- libgit2 0.25.0