From 9a545d34225b676d59eacb16e596450b0c606d14 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sat, 13 Mar 2021 12:01:46 +0800 Subject: [PATCH] save project --- __pycache__/red.cpython-37.pyc | Bin 0 -> 654 bytes day.py | 6 +++--- red.py | 27 +++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 __pycache__/red.cpython-37.pyc create mode 100644 red.py diff --git a/__pycache__/red.cpython-37.pyc b/__pycache__/red.cpython-37.pyc new file mode 100644 index 0000000..7b171df Binary files /dev/null and b/__pycache__/red.cpython-37.pyc differ diff --git a/day.py b/day.py index b2c65e2..aaebeba 100644 --- a/day.py +++ b/day.py @@ -1,4 +1,4 @@ -import fun -data = fun.new_input() -a=fun.sum(data) +import red +data = red.new_input() +a=red.sum(data) print(print("这位选手的总分数为:"+str(a))) diff --git a/red.py b/red.py new file mode 100644 index 0000000..1985f3f --- /dev/null +++ b/red.py @@ -0,0 +1,27 @@ +def new_input(): + total = [] + while True: + money = input('请输入(q退出):') + if money == 'q': + break + else: + try: + money = int(money) + except: + print("请重新输入一个数字") + else: + total.append(money) + finally: + print("-"*30) + return total +def sum(money): #money形式参数 + new_money=0 + for i in money: + new_money += i + return new_money + + + +result = new_input() +pay=sum(result) +# print("您一共消费了" + str(pay) + "元!扫码还是现金呢?") -- libgit2 0.25.0