When I execute the function below with the following arguments :
print(delete_starting_evens([4, 8, 10])) I get
 instead of the expected
. Why isn’t
10 getting popped? It is even, and it is at index 0 in the list at the time it is reached in the for loop.
def delete_starting_evens(lst): for element in lst: if lst % 2 == 0: lst.pop(0) else: break return lst
In case you’re curious this is from Python Code Challenges: Loops, exercise 3 in the Learn Python 3 course.