Commit aa567c59 by BellCodeEditor

auto save

parent 4a6abb13
Showing with 19 additions and 6 deletions
def sclk():
'''def jiage(): #创建 jiage函数 输出的列表里面内容是字符串,我需要输出整型
total = []
while True:
unit= input("请输入:")
unit= input("请输入:") #unit= int(input("请输入:")) 输入数字,正常运行;输入字母,报错
if unit== 'q':
break
break
else:
total.append(unit)
print(total)
print(total)'''
sclk()
\ No newline at end of file
#让代码不会报错,正确正常运行,错误输入提示语
total = []
while True:
try:
unit=input("请输入:")
aa = int(unit)
except:
if unit == 'q':
break
print("输入错误,请输入整数!!")
else:
total.append(aa)
print(total)
\ 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