Commit 9f7e7ca5 by BellCodeEditor

auto save

parent d7c22d68
Showing with 31 additions and 9 deletions
total = [] def new_input():
while True: total = []
unit= input("请输入:") while True:
if unit== 'q': unit= input("请输入:")
break if unit== 'q':
else: break
total.append(unit) else:
print(total) try:
\ No newline at end of file unit = int(unit)
except:
print('输入的数有问题,请重新输入!')
else:
total.append(unit)
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