某学校举办“校园演讲比赛”,每位选手由8位评委打分(分数为0~10的整数),且每位评委必须打分。计分规则:去掉一个最高分,去掉一个最低分。如下程序通过键盘先输入选手编号,然后依次输入8个分数,并计算最终得分。下列说法正确的是( )。

mr237883 单选题 共 个子题
for _ in range(10):

    id = int(input("输入选手编号:"))

    max_score, min_score = 0, 100 # 最高分和最低分
    total_score = 0 # 总分

    for i in range(1, 9):
        score = int(input(f"输入选手第{i}个成绩:"))

        if max_score < score:
            max_score = score

            if min_score > score:
                min_score = score

                total_score += score

                total_score = total_score - max_score - min_score
                print(f"""
                {id}号选手的成绩:
                    去掉一个最高分{max_score},
                    去掉一个最低分{min_score},
                    最后成绩是:{total_score}""")
A

上述代码能完成题目要求

B

max_score, min_score = 0, 100 应修改为 max_score, min_score = 0, 0

C

max_score < score 和 min_score > score 必须相应修改为 <= 和 >=

D

total_score = total_score - max_score - min_score 不能达到预期,可修改如下:

total = total_score - max_score - min_score
total_score = total
正在加载题目数据…
已答 /
子题
该题型需在试卷/作业中作答,单题练习暂不支持
答案解析
讨论
发布
登录后参与讨论 立即登录
发布讨论需先绑定并验证手机号 去绑定手机号
加载中…
我
我
回复 @
回复 @
发送
还没有人讨论,来发表第一条吧