From 2e0cd9993e44874e1ec07683a0ea2384c8bd1ef1 Mon Sep 17 00:00:00 2001
From: BellCodeEditor <bellcode_dev@bell.ai>
Date: Sun, 26 Mar 2023 15:20:23 +0800
Subject: [PATCH] save project

---
 func.py | 31 ++++++++++++++++++++++++-------
 1 file changed, 24 insertions(+), 7 deletions(-)

diff --git a/func.py b/func.py
index cd68b04..41241f6 100644
--- a/func.py
+++ b/func.py
@@ -1,7 +1,24 @@
-c=[]
-def sum():    
-    a=input("请输入单价")
-    c.append(a)
-    return c
-
-print(c)
\ No newline at end of file
+def new_input():
+    total = []
+    while True:
+        unit = input("请输入(q退出):")
+        if unit == "q":
+            break
+        else:
+            try:
+                unit = int(unit)
+            except:
+                print("请重新输入一个数字")
+            else:
+                total.append(unit)
+            finally:
+                print("====================")
+    return total
+def sum(money):
+    count = 0
+    for i in money:
+        count = count + i
+    return count
+price = new_input()
+pay = sum(price)
+print("你一共消费了" + str(pay) + "元!扫码还是现金?")
\ No newline at end of file
--
libgit2 0.25.0