Commit e9e98925 by BellCodeEditor

save project

parent 2e08678e
Showing with 13 additions and 3 deletions
...@@ -6,9 +6,13 @@ def new_input(): ...@@ -6,9 +6,13 @@ def new_input():
if a== 'q': if a== 'q':
break break
else: else:
try:
a = int(a)
except:
print("要输入数字啊!")
else:
total.append(a) total.append(a)
for i in total: sum += a
sum+=int(i)
print(total) print(total)
print(sum) print(sum)
new_input() new_input()
...@@ -6,8 +6,13 @@ def new_input(): ...@@ -6,8 +6,13 @@ def new_input():
if unit=='q': if unit=='q':
break break
else: else:
try:
unit=int(unit)
except:
print("输整数!")
else:
total.append(unit) total.append(unit)
sum += int(unit) sum += 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