Mixed numbers
Input
filter_evens([1, 2, 3, 4, 5, 6])
Output
[2, 4, 6]
Only even numbers 2, 4, 6 are kept, in the original order.
Full lesson preview
Return a new list containing only the even numbers from the input list, preserving order.
Problem statement
Task
Examples
Input
filter_evens([1, 2, 3, 4, 5, 6])
Output
[2, 4, 6]
Only even numbers 2, 4, 6 are kept, in the original order.
Input format
Output format
Constraints
Samples
Input
filter_evens([0, -2, 7])
Output
[0, -2]
0 and -2 are even; 7 is odd and removed.