Commit b09847fc by BellCodeEditor

save project

parent 6f8db381
Showing with 20 additions and 5 deletions
def sy(): def sy():
total = [] total = []
while True: while True:
unit= input("请输入:") un= input("请输入:")
if unit== 'q': if un== 'q':
break break
else: else:
total.append(unit) try:
un=int(un)
except:
print('请重新输入一个数字')
else:
total.append(un)
print('-'*30)
print(total) print(total)
sy() return total
\ No newline at end of file
def sum(u):
c=0
for a in u:
c=c+a
return c
r=sy()
pay = sum(r)
print("您一共消费了"+str(pay)+'元,扫码还是现金')
\ 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