Commit 4e1dd25e by BellCodeEditor

save project

parent dc70412a
Showing with 25 additions and 0 deletions
def n_input():
t = []
while True:
r = input('请输入:')
if r =='q':
break
else:
try:
r = int(r)
except:
print('请输入一个数字')
else:
t.append(r)
finally:
print('='*30)
return t
def sum(r):
c = 0
for i in r:
c = c + i
return c
p = n_input()
y = sum(p)
print('你一共消费了' + str(y) + '元')
\ 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