Commit 9f7e7ca5 by BellCodeEditor

auto save

parent d7c22d68
Showing with 26 additions and 4 deletions
total = []
while True:
def new_input():
total = []
while True:
unit= input("请输入:")
if unit== 'q':
break
else:
try:
unit = int(unit)
except:
print('输入的数有问题,请重新输入!')
else:
total.append(unit)
print(total)
\ No newline at end of file
finally:
print('#'*40)
return total
def sum(total_list):
count = 0
for i in total_list:
count = count +i
return count
total_list = new_input()
count = sum(total_list)
print(count)
\ 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