Counting seed values from first sequence in second sequence
<p>If a function is given a sequence <code>seeds</code> of seed values, it needs to count for every single seed value the number of times they show up in the 2nd sequence <code>xs</code>. Then it should return the counts as a list of integers, in the same order of the seed values. If <code>seeds</code> includes duplicated values, keep duplicated counts in the returned list. For example, <code>count_each([10,20],[10,20,50,20,40,20])</code> should return <code>[1,3]</code> and <code>count_each('aeiou','encyclopedia') should return [1,2,1,1,0]</code>.</p>

<p>I'm stuck on how to program this function. This is what I have so far but I can't figure out how exactly I would count the number of seed values in the second sequence and not just check if the values exist. Any help on this would be appreciated. </p>

<pre><code>def count_each(seeds,xs):   

    if seeds in xs:
        if seeds == True
    return seeds
        elif seeds == False
    return None
</code></pre>

<p>Check out <code>collections.Counter()</code></p>

<pre><code>import collections

def count_each(seeds,xs): 
    c = collections.Counter(xs)
    return [c[seed] for seed in seeds]
</code></pre>

python sequence counting seed