Intern — Middle
Filtering odd elements of a list using lambda and filter function
livecode
Task condition
Explain how the following code snippet works.
data = [1, 2, 3, 4, 5]
odd_numbers = filter(lambda x: x % 2, data)
livecode
Task condition
Explain how the following code snippet works.
data = [1, 2, 3, 4, 5]
odd_numbers = filter(lambda x: x % 2, data)