cj = [654, 643, 621, 612, 609, 606, ...] # 学生成绩存列表 cj 并已经降序排序
def dfsearch(key):
i = 0
j = len(cj) - 1
while i <= j:
m = (i + j) // 2
if cj[m] > key:
①
else:
j -= 1
return ②
key = int(input('输入待查找的成绩'))
pos = ③
print('高于', key, '分的人数有', pos)
i += 1或等价表达式(2分)
i或等价表达式(3分)
dfsearch(key)或等价表达式(3分)