Commit d25f0c3e by BellCodeEditor

auto save

parent e51af509
Showing with 14 additions and 5 deletions
...@@ -5,8 +5,18 @@ def new_input(): ...@@ -5,8 +5,18 @@ def new_input():
if u=="q": if u=="q":
break break
else: else:
total.append(u) try:
u=int(u)
except:
print("请重新输入一个数字")
else:
total.append(u)
return total return total
result=new_input() def sum(money):
print(result) count=0
new_input() for i in money:
\ No newline at end of file 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