Commit 402fc1dd by BellCodeEditor

save project

parent 1bb333ec
Showing with 28 additions and 14 deletions
a=[]
while True:
b=input("请输入:")
if b=="q":
break
else:
try:
b=int(b)
except:
print("请输入整数")
def new_input():
a=[]
while True:
b=input("请输入:")
if b=="q":
break
else:
a.append(b)
print(a)
\ No newline at end of file
try:
b=int(b)
except:
print("请输入整数")
else:
a.append(b)
return a
def sum(money):
count=0
for i in money:
count=count+i
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