The skip_elements function returns a list containing every other element from an input list, starting with the first element. Complete this function to do that, using the for loop to iterate through the input list.
def skip_elements(elements):
# Initialize variables
new_list = []
i = 0
# Iterate through the list
for element in elements:
# Does this element belong in the resulting list?
if elements[i] == element:
# Add this element to the resulting list
new_list.append(element)
# Increment i
i += 2
return new_list
This is what I tried and it didn't work. Help