Commit c4ad3ed3 by BellCodeEditor

save project

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