In the code challenges, below is the problem statement:
Write a function called
delete_starting_evens() that has a parameter named
The function should remove elements from the front of
lst until the front of the list is not even. The function should then return
For example if
lst started as
[4, 8, 10, 11, 12, 15] , then
delete_starting_evens(lst) should return
[11, 12, 15] .
Make sure your function works even if every element in the list is even!
and i tried solving it by following the below code
for num in lst:
if num%2 == 0:lst.remove(num) continue
#Uncomment the lines below when your function is done
print(delete_starting_evens([4, 8, 10, 11, 12, 15]))
print(delete_starting_evens([4, 8, 10]))
however the code is turning out wrong as output is being shown as
[8, 11, 15]
can u help telling me why ?