题目
题目
单项选择题

numbers = [1, 4, 6]Which of the following would produce the result: [6]

选项
A.list(filter(lambda x: 6, numbers))
B.list(filter(lambda x: x % 3 == 0, numbers))
C.list(filter(lambda x: x // 2 == 2, numbers))
D.list(filter(lambda x: x % 2 == 0, numbers))
查看解析

查看解析

标准答案
Please login to view
思路分析
We start by restating the setup and the goal to make sure the logic is clear. The list is numbers = [1, 4, 6], and the target result is [6], i.e., filtering should keep only elements that meet a certain condition. Option 1: list(filter(lambda x: 6, numbers)). Here, the lambda returns 6 for every ele......Login to view full explanation

登录即可查看完整答案

我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!