租用问题

质量为本、客户为根、勇于拼搏、务实创新

< 返回租用问题列表

python如何求最高分和最低分,python求最大值函数

发布时间:2023-08-15 07:58:47

python如何求最高分和最低分

可使用Python的内置函数`max()`和`min()`来求最高分和最低分。
假定有一个学生成绩列表`scores`,可使用以下代码求最高分和最低分:
```
scores = [80, 90, 70, 85, 95]
highest_score = max(scores)
lowest_score = min(scores)
print("最高分:", highest_score)
print("最低分:", lowest_score)
```
输出结果为:
```
最高分: 95
最低分: 70
```
这样就能够求得列表中的最高分和最低分。