Commit c0c9a0fd by BellCodeEditor

save project

parent 7eaed43a
Showing with 21 additions and 0 deletions
def a():
total = []
while True:
unit=input("请输入:")
#赋值unit
if unit == 'q':
break
else:
try:
unit == int(unit)
#如果unit是整数
except:
print("请输入整数")
#报错后的程序
else:
total.append(int(unit))
print("已添加")
#如果程序不报错
print(total)
a()
\ 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