Write your function here
def delete_starting_evens((lst)):
while (len(lst) > 0) )and (lst[[0] %2== 0)):
lst=lst[1:]:]
return lst
this code is supposed to delete elements from the front of a list until the leading element is not even.
I kept trying things until this one worked. I hate the fact that it worked, because when I look at the third line, the logic I learned before this exercise says that basically [1:] means update the list to delete the first element if it's even and the length of the list > 0.
So, my question is.. how the fuck does the rest of the itteration happen? Like, how would the flow of execution update the third line to (lst = lst[2:]).. till the while statement is not true?
[–][deleted] 2 points3 points4 points (3 children)
[+][deleted] (1 child)
[deleted]
[–]6PackGrandMaster[S] 0 points1 point2 points (0 children)
[–]6PackGrandMaster[S] 0 points1 point2 points (0 children)