Even All the Way

Published by Joshua Señoron in

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.

Watch a quick demo on how Edabit works.