Commit 57f06cd7 by BellCodeEditor

save project

parent 281c798c
Showing with 14 additions and 6 deletions
def s(): def s():
a=[] a=[]
while True: while True:
money=input("请输入(z退出):") n=input("请输入(z退出):")
if money=="z": if n=="z":
break break
else: else:
try: try:
money=int(money) n=int(n)
except: except:
print("请重新输入:") print("请重新输入:")
else: else:
a.append(money) a.append(n)
print("="*100) print("="*100)
return a return a
def sum(money):
c=0
for i in money:
c=c+i
return c
x=s() x=s()
print(x) p=sum(x)
\ No newline at end of file print("你一共消费了"+str(p)+"元!!!请付账!!!!!")
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