1. 输入输出示例: 请输入某同学的三个分数:56 78 90 2. 科目 1=56 分,等级不及格科目 2=78 分,等级中等科目 3=90 分,等级优秀
时间: 2023-05-18 10:02:53 浏览: 78
这是一个计算学生分数等级的程序,可以使用以下代码实现:
```python
scores = input("请输入某同学的三个分数:").split()
score1, score2, score3 = map(int, scores)
if score1 < 60:
level1 = "不及格"
elif score1 < 80:
level1 = "中等"
else:
level1 = "优秀"
if score2 < 60:
level2 = "不及格"
elif score2 < 80:
level2 = "中等"
else:
level2 = "优秀"
if score3 < 60:
level3 = "不及格"
elif score3 < 80:
level3 = "中等"
else:
level3 = "优秀"
print("科目 1={} 分,等级{};科目 2={} 分,等级{};科目 3={} 分,等级{}".format(score1, level1, score2, level2, score3, level3))
```
输入示例:
```
请输入某同学的三个分数:56 78 90
```
输出示例:
```
科目 1=56 分,等级不及格;科目 2=78 分,等级中等;科目 3=90 分,等级优秀
```
阅读全文
相关推荐
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044955.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044736.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231045021.png)
![-](https://img-home.csdnimg.cn/images/20241231044901.png)
![-](https://img-home.csdnimg.cn/images/20241231044955.png)
![-](https://img-home.csdnimg.cn/images/20241231045021.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044937.png)
![-](https://img-home.csdnimg.cn/images/20241231044955.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)