用python给定一个学生成绩列表[66, 55, 46, 87, 77, 98, 55, 70, 67, 60, 79, 86],求出成绩大于等于60的分数
时间: 2023-04-05 10:01:35 浏览: 38
可以使用以下代码来求出成绩大于等于60的分数:
```python
scores = [66, 55, 46, 87, 77, 98, 55, 70, 67, 60, 79, 86]
passed_scores = [score for score in scores if score >= 60]
print(passed_scores)
```
输出结果为:
```
[66, 87, 77, 98, 70, 67, 60, 79, 86]
```
相关问题
用python 给定一个学生成绩列表[66, 55, 46, 87, 77, 98, 55, 70, 67, 60, 79, 86],求出成绩大于等于60的分数
可以使用以下代码来求出成绩大于等于60的分数:
```
scores = [66, 55, 46, 87, 77, 98, 55, 70, 67, 60, 79, 86]
passed_scores = [score for score in scores if score >= 60]
print(passed_scores)
```
输出结果为:[66, 87, 77, 98, 70, 67, 60, 79, 86]
python给定一个学生成绩列表[66, 55, 46, 87, 77, 98, 55, 70, 67, 60, 79, 86],求出成绩大于等于60的分数 简单做法
可以使用列表推导式来实现,代码如下:
```python
scores = [66, 55, 46, 87, 77, 98, 55, 70, 67, 60, 79, 86]
passed_scores = [score for score in scores if score >= 60]
print(passed_scores)
```
输出结果为:
```
[66, 87, 77, 98, 70, 67, 60, 79, 86]
```
阅读全文