Commit 925b0f7f by BellCodeEditor

save project

parent b776391d
Showing with 14 additions and 6 deletions
...@@ -6,14 +6,23 @@ def new_input(): ...@@ -6,14 +6,23 @@ def new_input():
break break
else: else:
try: try:
unit=int(money) unit=int(unit)
except: except:
print('重新输入') print('重新输入')
else: else:
total.append(money) total.append(unit)
print("_"*30) finally:
print("=====================")
return total return total
r=new_input() def sum(money):
print(r) count=0
\ No newline at end of file for i in money:
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