原题地址:
解题思路:
简单题,主要熟悉Python一些基本方法
注意事项:
无
参考代码:
scores_a, scores_b, scores_c, scores_d, scores_e = [], [], [], [], [] n = int(input().strip()) scores = list(map(int, input().strip().split())) for i in scores: if 0 <= i <= 59: scores_e.append(i) elif 60 <= i <= 69: scores_d.append(i) elif 70 <= i <= 79: scores_c.append(i) elif 80 <= i <= 89: scores_b.append(i) elif 90 <= i <= 100: scores_a.append(i) len_a, len_b, len_c, len_d, len_e = len(scores_a), len(scores_b), len(scores_c), len(scores_d), len(scores_e) print(len_a, len_b, len_c, len_d, len_e) print(max(len_a, len_b, len_c, len_d, len_e)) temp = max(scores_a, scores_b, scores_c, scores_d, scores_e, key=lambda list_: len(list_)) temp.sort(reverse=True) print(*temp)
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题10.1 (Java代码)浏览:1447 |
C语言程序设计教程(第三版)课后习题6.1 (C语言代码)浏览:609 |
Pascal三角 (C语言代码)格式错误浏览:521 |
C语言程序设计教程(第三版)课后习题1.5 (C++代码)浏览:1095 |
【亲和数】 (C语言代码)浏览:503 |
C语言程序设计教程(第三版)课后习题7.1 (C语言代码)浏览:1229 |
C语言程序设计教程(第三版)课后习题8.5 (C语言代码)浏览:545 |
剪刀石头布 (C语言代码)浏览:754 |
【蟠桃记】 (C语言代码)浏览:1035 |
1113题解浏览:790 |