def count(sequence, item): count = 0 for sth in sequence: if sth == item: count += 1 return count
Actually it says this is right and working, but am i thinking too much for this example?
of course it counts right when variable ‘sequence’ is a normal list like [1,2,3,1]
but it doesn’t count right when the list has a list in it, like [1,2,[1,2,3]]
Am I thinking out of bounds? Didn’t example want to think that much?
Whether or not, how can i count an item in the list in another list?