Commit 6c2a16f7 by BellCodeEditor

save project

parent 5e33a84d
Showing with 18 additions and 4 deletions
...@@ -2,9 +2,24 @@ def new_input(): ...@@ -2,9 +2,24 @@ def new_input():
total = [] total = []
while True: while True:
unit= input("请输入:") unit= input("请输入:")
if unit== 'q':def if unit== 'q':
break break
else: else:
try:
mony=int(mony)
except:
print("请输入一个数字")
else:
total.append(unit) total.append(unit)
print(total) finally:
new_input() print("-"*30)
\ No newline at end of file return total
def sum(money):
coung=0
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