11. Count https://www.codecademy.com/en/courses/python-intermediate-en-rCQKw/2/1?curriculum_id=4f89dab3d788890003000096#
Error messages: Oops, try again. Your function fails on count([4, 'foo', 'foo'],5). It returns 1 when it should return 0.
But in Canopy, it words fine with a result of 0, which is quite weird. Could anyone tell me why my code is wrong? Many thanks!!
def count(sequence, item): times=0 for item1 in sequence: if item in sequence: times+=1 sequence.remove(item) return times