input那一行,你转int了,输入非数字的字符肯定会抛出异常啊。
不要转,可以在if里面判断数字
while True:
score = input("请输入学生成绩: ")
print("你的输入: %s" % str(score))
if score.isdigit():
score = int(score)
if x >= 0 and x <= 100:
z = zongfen(x)
else:
print("成绩超出范围!")
else:
print("输入违法")
print("处理完成: %s " %str(score))
错误信息在哪