用if语句嵌套以[93,85,94,99]的输出列表作为输入,输出分级后的列表
时间: 2024-04-30 18:24:11 浏览: 145
代码如下:
```
scores = [93, 85, 94, 99]
graded_scores = []
for score in scores:
if score >= 90:
graded_scores.append('A')
elif score >= 80:
graded_scores.append('B')
elif score >= 70:
graded_scores.append('C')
elif score >= 60:
graded_scores.append('D')
else:
graded_scores.append('F')
print(graded_scores)
```
输出结果为:
```
['A', 'B', 'A', 'A']
```
阅读全文