Commit c4ad3ed3 by BellCodeEditor

save project

parent 479f0bea
Showing with 10 additions and 5 deletions
def new_input():
total = []
while True:
unit=input("请输入")
unit=input("请输入:")
if unit =="q":
break
try:
unit = int(unit)
a = int(unit)
except:
print("请重新输入")
else:
total.append(unit)
total.append(a)
return total
b=new_input()
print(b)
\ No newline at end of file
def sum(money):
s=0
for i in money:
s=s+i
print("共消费"+str(s)+"元")
sum(b)
\ 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