Commit 8547596d by BellCodeEditor

save project

parent dc70412a
Showing with 26 additions and 0 deletions
def new_input():
total = []
print("+"*147)
while True:
unit= input("请输入:")
try:
a=int(unit)
except:
if unit== 'q':
break
print("请输入整数")
else:
total.append(a)
print("+"*147)
return total
def sum(b):
sum1=0
for i in b:
sum1+=i
return sum1
c=new_input()
d=sum(c)
print("您一共消费了"+str(d)+"元!")
\ 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