Commit e9e98925 by BellCodeEditor

save project

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