From 186ffa169ae3c221ac413b043acb08f2c526d176 Mon Sep 17 00:00:00 2001
From: BellCodeEditor <bellcode_dev@bell.ai>
Date: Thu, 23 Dec 2021 20:25:04 +0800
Subject: [PATCH] save project

---
 func.py | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/func.py b/func.py
index eaa357a..8ced6e2 100644
--- a/func.py
+++ b/func.py
@@ -1,14 +1,17 @@
-total = []
 def new_input():
+    total = []
     while True:
-        try:
-            unit= int(input("请输入:"))
-        except:
-            print("输入错误!")
+        unit=(input("请输入单价(q退出):"))
+        if unit== 'q':
+            break
         else:
- #           if unit== 'q':
-  #              break
- #           else:
-            total.append(unit)
-            print(total)
+            try:    
+                unit=int(unit)
+            except:
+                print("请重新输入一个数字")
+            else:
+                total.append(unit)
+            finally:
+                print("-"*30)
+    print(total)
 new_input()
\ No newline at end of file
--
libgit2 0.25.0