title: Counting occurrences using filter and reduce in Python
body: <pre><code>c=["pink", "purple", "black", "yellow", "purple", "indego", "white", "peach"]
  import random
  import collections
  def apply(T):
      i = random.randint(0, 7)
      return c[i]
  for x in range(1, 50):
      for ch in map(apply, c):
          print(ch)
  </code></pre>
  
  <p>I'm trying to figure out how to count the occurrences of each of the numbers by only using the filter and reduce functions.</p>
  
  <p>Could anybody point me in the right direction? </p>
  
  <p>EDIT: FOR CLARIFICATION, I want to count the amount of times a random number of a certain type is generated, not the one in the list!</p>