Commit e8d6746f by BellCodeEditor

auto save

parent dc70412a
Showing with 26 additions and 0 deletions
def new_input():
total = []
while True:
unit = input("请输入:(输入q退出)")
try:
a=int(unit)
except:
if unit == "q":
break
print("不是整数,给我输入整数。")
else:
total.append(a)
finally:
print("-"*147)
print(total)
return total
def sum(b):
sum1 = 0
for i in b:
sum1 = sum1+i
return sum1
c = new_input()
d = sum(c)
print("您总共消费"+str(d) +"元","是要扫码还是现金?")
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