my code and result the tutorial code and result
This is my code
def delete_starting_evens(lst):
for x in lst:
if x%2 == 0:
lst = lst[1:]
else:
return lst
print(delete_starting_evens([4, 8, 10, 11, 12, 15]))
print(delete_starting_evens([4, 8, 10]))
I get:
[11, 12, 15]
None
I was expecting to get:
[11, 12, 15]
[]
Can someone explain this?
Picture one is my trial. Picture two is the standard answer. I try to get an empty list by using my for loop. However, it seems that the [] still satisfy the condition of my for loop and somehow make the [] become a None object. Can someone please explain this?