← Back to challenges

Even All the Way

PythonHardarraysnumberslanguage_fundamentals

Instructions

Given a list of numbers, return a list which contains all the even numbers in the original list, which also have even indices.

Examples

get_only_evens([1, 3, 2, 6, 4, 8]) ➞ [2, 4]

get_only_evens([0, 1, 2, 3, 4]) ➞ [0, 2, 4]

get_only_evens([1, 2, 3, 4, 5]) ➞ []

Notes

Lists start at index 0.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Inclusive List Ranges