From 8835e8cdd77e989c832fc8ca999b186162c04a40 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sun, 3 Mar 2024 11:09:50 +0800 Subject: [PATCH] save project --- func.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 func.py diff --git a/func.py b/func.py new file mode 100644 index 0000000..e189e55 --- /dev/null +++ b/func.py @@ -0,0 +1,23 @@ +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(price): + count=0 + for i in price: + count+=i + return count + +result=new_input() +play=sum(result) +print('您一共消费了'+str(play)+'元,请问是现金还是扫码呢?') \ No newline at end of file -- libgit2 0.25.0