Actually, it says that I passed the test, but I wanted to run it in any possibility.
It says that item can be another list, so I was eager to check it out.
Can you please help me out on how to solve this?
I want to add two lists, other shorter then the previous one and check how many times does the longer list contain the smaller one.
This one doesn’t work. I have no idea why.
I know it’s a bit messed up, but after hour of figuring I changed a lot of code, so…
def count(sequence, item): occurence_count = 0 if type(item) is int or type(item) is float or \ type(item) is str: for i in sequence: if i == item: occurence_count += 1 return occurence_count elif type(item) is list: for a, b in zip(sequence, item): abcount = 0 *The count of matches* while abcount < len(item): if a == b: abcount += 1 break else: if abcount == len(item): occurence_count += 1 return occurence_count count([1,2,3,4,5,6,7], [1,2,3])