Can anyone help me with this code challenge on python?

3. Delete Starting Even Numbers

my code:
def delete_starting_evens(lst):
a = len(lst)
while a >=0:
if lst[0] % 2 == 0:
a = a-1
return lst

#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]))

it returns an error code:
Traceback (most recent call last):
File “”, line 14, in
print(delete_starting_evens([4, 8, 10, 11, 12, 15]))
File “”, line 5, in delete_starting_evens
if lst[0] % 2 == 0:
TypeError: ‘int’ object is not subscriptable

but this line of code in error, lst[0] % 2 == 0, is also in the answers. I wonder why mine would not work?

You must select a tag to post in this category. Please find the tag relating to the section of the course you are on E.g. loops, learn-compatibility

When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!

If you want to have the best chances of getting a useful answer quickly, make sure you follow our guidelines about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer! :slight_smile:

Mutate the list you are iterating and pay the price.