万卷网 > 题目详情
题型:单选题

某学校举办“十佳歌手大奖赛”,经过选拔最终参赛选手有25人,评委10人,最终计分规则去掉一个最高分 去掉一个最低分作为该参赛选手的最终得分,并输出该得分。每位评委都必须打分,且分数都大于等0。相关说法正 确的是( )。

for _ in range(25):
    max_score = 0 #记录最高分
    min_score = 9999 #记录最低分
    total_score = 0 #记录总分
    for _ in range(10):
        now_score = float(input()) #录入评委打分
        if now_score > max_score:
            max_score = now_score
        if now_score < min_score:
            min_score = now_score
        total_score += now_score
    print(total_score - max_score - min_score)
A.

程序总体逻辑错误。因为要去掉最高分和最低分,需要排序,而程序没有相关代码。

B.

内层循环和外层循环之间的三行代码也就是 max_score = 0 开始的三行代码应该移动到外层循环外。

C.

if now_score > max_score 和 if now_score < min_score 中的 > 和 < 分别调整为 >= 和 <= 不

影响程序执行结果。

D.

total_score += now_score 不可以更改为 total_score = total_score + now_score 。

更新时间:2026-07-17 16:09:24 |
【知识点】 CCF—GESP Python二级

相似题推荐

单选题

下面的Python 代码执行后其输出是( )。

cnt = 0
for i in range(1, 5):
    for j in range(i):
        print(j, end = "#")
    break
else:
    print(i*j)
A.

0#0#1#0#1#2#0#1#2#3#12

B.

0#0#1#0#1#2#0#1#2#3#

C.

0#

D.

1#

2026-07-31
判断题

下列Python 代码执行后将输出1#4#9#16#16 。()

for i in range(1, 5):
    for j in range(1, i + 1):
        if i * j % 10 == 0:
            break
    else:
        print(i * j, end = "#")
else:
    print(i * j)
A.正确 B.错误
2026-07-31
判断题

下面的Python 代码执行将不会有输出,因为内层循环j 总是0 开始,i * j % 10 == 0 将会被满足,执行break,故而不会执行代码中的else 子句部分。()

for i in range(1, 10):
    for j in range(i):
        if i * j % 10 == 0:
            break
else:
    print(i*j)


A.正确 B.错误
2026-07-31
判断题

执行下面的Python 代码,其语句print(N) 将被执行0 次或极多次(即死循环)。()

N = input() 
while N :
    print(N)
A.正确 B.错误
2026-07-31
单选题

下面选择项中,与Python 表达式not (x > 5 and y <= 10)等价的是( )。

A.

x <= 5 and y > 10

B.

x > 5 or y <= 10

C.

x <= 5 or y > 10

D.

not x > 5 and not y <= 10

2026-07-31
公众号
客服 反馈
顶部