Commit eeb3932c by BellCodeEditor

save project

parent 4913b709
Showing with 11 additions and 10 deletions
...@@ -2,17 +2,17 @@ def new_input(): ...@@ -2,17 +2,17 @@ def new_input():
total = [] total = []
sum = 0 sum = 0
while True: while True:
try: unit= input("请输入:")
unit= input("请输入:") if unit== 'q':
if unit== 'q': break
break
except:
print("请输入整数!")
else: else:
if unit=='q': try:
break unit=int(unit)
total.append(unit) except:
sum +=int(unit) print("请输入整数!")
else:
total.append(unit)
sum +=int(unit)
print(total) print(total)
print(sum) print(sum)
new_input() new_input()
\ 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