In what way does your code behave incorrectly? Include ALL error messages.
Code executes perfectly in editor, however it does not provide the same result when executed in the validation. I get the error:
"Oops, try again. Your function fails on count([4, 'foo', 'foo'],5). It returns 1 when it should return 0."
While when I write print count([4, 'foo', 'foo'],5) after my function it returns the correct value.
What do you expect to happen instead?
I expect the code to run in the validation with no mistakes in output.
def count(sequence,item): c=0 while item in sequence: del sequence[sequence.index(item)] c+=1 return c