Commit 7dc8d3af by BellCodeEditor

auto save

parent 024fb164
Showing with 26 additions and 9 deletions
total = []
while True:
unit= input("请输入:")
if unit== 'q':
break
else:
total.append(unit)
print(total)
\ No newline at end of file
def sbzrz():
dsbzrz=[]
while True:
qjdsbzrz=input("(q退出)请输入:")
if qjdsbzrz=="q":
break
else:
try:
qjdsbzrz=int(qjdsbzrz)
except:
print("请重新输入数字")
else:
dsbzrz.append(qjdsbzrz)
finally:
print("-"*30)
return dsbzrz
def sum(money):
count=0
for i in money:
count=count+i
return count
lxgzrz=sbzrz()
lspzrz=sum(lxgzrz)
print("你一共消费了"+str(lspzrz)+"元")
\ 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