第42075题 单选题
上上题qSort()函数不支持排序规则函数,形如sorted()函数的key参数,为实现类似目标,横线处分别应填入代码是( )。
def qSort(lst,fx = None):

    if len(lst) <= 1:
        return lst
    else:
        Pivot = lst[0]
        if ________:
            Less = [x for x in lst[1:] if _________]
            Greater = [x for x in lst[1:] if ____________]
            return qSort(Less,fx) + [Pivot] + qSort(Greater,fx)
        else:
            Less = [x for x in lst[1:] if x <= Pivot]
            Greater = [x for x in lst[1:] if x > Pivot]
            return qSort(Less,fx) + [Pivot] + qSort(Greater,fx)

lstA = [1,2,11,12,21,21,2,3,41,4,3]

lstB = qSort(lstA, lambda x:x % 10)
print(lstA, lstB)
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
知识点:
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析