Commit d9822386 by BellCodeEditor

auto save

parent 896e14ed
Showing with 20 additions and 3 deletions
...@@ -5,7 +5,6 @@ def n_w(): ...@@ -5,7 +5,6 @@ def n_w():
if unit== 'q' or unit== 'Q': if unit== 'q' or unit== 'Q':
break break
else: else:
try: try:
unit = int(unit) unit = int(unit)
except: except:
...@@ -13,8 +12,8 @@ def n_w(): ...@@ -13,8 +12,8 @@ def n_w():
else: else:
total.append(unit) total.append(unit)
return total return total
# a = n_w() a = n_w()
# print(a) print(a)
...@@ -30,6 +29,7 @@ def sum(b): ...@@ -30,6 +29,7 @@ def sum(b):
for i in b: for i in b:
count = count + i count = count + i
return count return count
price = n_w() price = n_w()
pay = sum(price) pay = sum(price)
print("您一共消费了" + str(pay) + "元!扫码还是现金呢?") print("您一共消费了" + str(pay) + "元!扫码还是现金呢?")
......
def n_w():
total = []
while True:
unit= input("请输入:")
if unit== 'q' or unit== 'Q':
break
else:
try:
unit = int(unit)
except:
print("请重新输入一个数字")
else:
total.append(unit)
return total
a = n_w()
print(a)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment