def input_score():
while True:
try:
score = int(input("录入学生成绩:"))
return score
except:
continue
while True:
code = input("输入选项代号:")
if code == '1':
score = input_score()
print(score)
掌握这个字串的方法 isnumeric()
score = ''
while not score.isnumeric():
score = input("录入学生成绩:")
print(int(score))