第31625题 单选题
执行如下Python代码,print(res)的输出结果为?
nums = [3, 1, 4, 1, 5, 9, 2, 6]
res = sorted(nums, key=lambda x: x % 3, reverse=True)
print(res)
A

[5, 2, 1, 4, 1, 3, 9, 6]

B

[1, 1, 2, 3, 4, 5, 6, 9]

C

[9, 6, 5, 4, 3, 2, 1, 1]

D

运行抛出异常,sorted不支持匿名函数作为key参数

程序运行统计
暂无判题统计
提交0次 正确率0.00%
答案解析