Commit 7400a929 by BellCodeEditor

save project

parent a7140056
Showing with 8 additions and 1 deletions
......@@ -5,7 +5,13 @@ def new_input(): #这是定义函数
if unit== 'q':
break
else:
total.append(unit)
try: #判断会不会报告出错
unit=int(unit)
except: #出错了才会执行
print("你输入的不是数字,重新输入")
else: #正确了才会执行
total.append(unit)
print("-"*30)
print(total)
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