For the one of the tasks in the loops challenge I wrote the following solution:
#Write your function here def delete_starting_evens(lst): for l in lst: if lst % 2 == 0: lst.remove(lst) else: break return lst
It passes the first test however on the following test:
print(delete_starting_evens([4, 8, 10]))
It fails and returns a list containing 10.
When I substituted the remove line with a:
lst = lst[1:]
It worked perfectly. Could someone explain to me why and what is the difference between remove and the other method (I know that .remove removes the first incident of something but are there any other differences that could be relevant to what I described).