Commit 206b8c92 by BellCodeEditor

save project

parent dc70412a
Showing with 26 additions and 0 deletions
def new():
total = []
while True:
unit = input("请输入一个整数(q退出)")
if unit =='q':
break
else:
try: #类型转换反正错误
inu = int(unit)
except:
print("请输入一个整数")
else:
total.append(inu)
return total
reture = new()
def sum(money):
count = 0
for i in money:
count = count+i
return count
zongjia = sum(reture)
print("您一共消费"+str(zongjia))
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