Commit c7bc9f61 by BellCodeEditor

auto save

parent 58bf98d8
Showing with 70 additions and 20 deletions
def new_aa():
a=[]
while True:
went1 = input("请输入价格:(按q退出)")
if went1 == 'q'
break
try:
a = int(went1)
except:
print("请重新输入一个数字")
else:
a.append(a)
finally:
print("-"*30)
return a
print(a)
new_aa()
\ No newline at end of file
def w():
def w():
a=[]
while True:
b=input("请输入价格:(按q退出)")
if b == 'q':
break
else:
try:
p=int(b)
except:
print("请重新输入一个数字")
else:
a.append(p)
finally:
print("="*30)
return a
def r(d):
t=0
for i in d:
t=t+i
return t
y=w()
l=r(y)
print("你一共消费"+str(l)+"元")
\ 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