Commit 43803048 by BellCodeEditor

auto save

parent 7553581a
Showing with 15 additions and 7 deletions
def new_input(): def new_input():
total = [] total = []
while True: while True:
unit= input("请输入:") money= input("请输入(q):")
if unit=='q': if money=='q':
break break
else: else:
try: try:
unit=int(unit) money=int(money)
except: except:
total.append(unit) print("请重新输入一个数字")
print("-"*30) finally:
print(total) print("============")
new_input() return total
def sum(money):
count=0
for i in money:
count=count+1
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