第41276题 单选题
小北的身高是1.65米。班上有n个小朋友,小北想和身高最接近自己的人交朋友。如果有多个小朋友与小北的身高差相同,小北想和其中身高较矮的第一个小朋友做朋友。横线处应该填入的代码是( )。
n = int(input("请输入小朋友的人数: "))
target = 1.65
best_height = 0.0
min_diff = 100.0

for i in range(n):
    h = float(input(f"请输入第 {i} 个小朋友的身高: "))
    diff = abs(h - target)

    if ____________________: # 横线处填空
        min_diff = diff
        best_height = h

print("小北的朋友身高为:", best_height)
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
知识点:
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析