Commit d09d4482 by BellCodeEditor

auto save

parent 9e4be219
Showing with 998 additions and 7 deletions
def new_input(): def new_input():
total = [] total = []
while True: while True:
unit= input("请输入(q退出):") money = input("请输入(q退出):")
if unit== 'q': if money== 'q':
break break
else: else:
try: try:
unit=int(unit) money =int(money)
except: except:
print('输数字') print('输数字')
else: else:
total.append(unit) total.append(money)
print(total) finally:
new_input() input ("-"*30)
\ No newline at end of file return total
def sum(unit):
count = 0
for i in unit:
count = count + i
return count
price = new_input()
pay = sum(price)
print("一共消费" + str(pay) + "元!扫码还是现金")
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