def evaluate_grade(score):
if not isinstance(score, (int, float)):
raise ValueError("输入的成绩必须是整数或浮点数")
if score < 0 or score > 100:
raise ValueError("输入的成绩必须在0到100之间")
if score >= 90:
return "优秀"
elif score >= 80:
return "良好"
elif score >= 60:
return "及格"
else:
return "不及格"
11-23
4123
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-03
428
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交