将三十个人的成绩输入,并显现出每个分数段人数
时间: 2023-05-10 13:55:07 浏览: 128
统计给定16名学生的成绩统计各段人数
好的,以下是代码实现:
```python
scores = []
for i in range(30):
score = int(input("请输入第{}个人的成绩:".format(i+1)))
scores.append(score)
# 统计分数段人数
less_than_60 = 0
between_60_and_70 = 0
between_70_and_80 = 0
between_80_and_90 = 0
greater_than_90 = 0
for score in scores:
if score < 60:
less_than_60 += 1
elif score < 70:
between_60_and_70 += 1
elif score < 80:
between_70_and_80 += 1
elif score < 90:
between_80_and_90 += 1
else:
greater_than_90 += 1
# 显示每个分数段人数
print("60分以下:{}人".format(less_than_60))
print("60分-70分:{}人".format(between_60_and_70))
print("70分-80分:{}人".format(between_70_and_80))
print("80分-90分:{}人".format(between_80_and_90))
print("90分以上:{}人".format(greater_than_90))
```
希望能够帮到你!
阅读全文