Heyo, I was wondering if you could help me understand this:
My initial attempt was to try and .pop the first (0th?) element from the list, using the following code:
def delete_starting_evens(lst):
i = 0
while lst[i] % 2 == 0:
lst.pop(i)
return lst
Which works for list#1. I quickly realized I had been a bit too eager, though, having proceeded without fully reading the exercise - it needs to work even if every element is even. So I came up with:
def delete_starting_evens(lst):
if len(lst) > 0:
i = 0
while lst[i] % 2 == 0:
lst.pop(i)
return lst
else:
return lst
but this throws a tab error. To my naive mind it seems as if the lines are correctly indented? I had to edit my code a couple times when pasting it here as it came out with different indentations than in my script (a clue!), which I promptly changed and ran again to no avail.
What am I missing here?