Brandon C. answered 02/02/23
Senior Software Engineer with University Computer Science Background
this is all you need
input = ['a', 'b', 'c', 'd', 'e', 'f', 'g']
print(input[::2])
The syntax for slicing goes, [<start>:<end>:<step>]
Since we don't set a start or an end, the slice will encompass the entire array. But by setting the step to 2, we utilize the elements starting at index 0, then step forward 2 indexes and use that element, then keep stepping forward 2 indexes repeatedly until we run out of elements in our array. Thus we will use every other elements in our input list