Counting frequencies in two lists, Python
<p>I'm new to programming in python so please bear over with my newbie question...</p>

<p>I have one initial list (list1) , which I have cleaned for duplicates and ended up with a list with only one of each value (list2): </p>

<p>list1 = [13, 19, 13, 2, 16, 6, 5, 19, 20, 21, 20, 13, 19, 13, 16],</p>

<p>list2 = [13, 19, 2, 16, 6, 5, 20, 21]</p>

<p>What I want is to count how many times each of the values in "list2" appears in "list1", but I can't figure out how to do that without getting it wrong. </p>

<p>The output I am looking for is something similar to this: </p>

<p>Number 13 is represented 1 times in list1. 
........ Number 16 is represented 2 times in list1. </p>

<p>You can also use operator</p>

<pre><code>&gt;&gt;&gt; list1 = [13, 19, 13, 2, 16, 6, 5, 19, 20, 21, 20, 13, 19, 13, 16],
&gt;&gt;&gt; list2 = [13, 19, 2, 16, 6, 5, 20, 21]

&gt;&gt;&gt; import operator
&gt;&gt;&gt; for s in list2:
...    print s, 'appearing in :',  operator.countOf(list1, s)
</code></pre>

python list frequency counting