title: Generate a list using list comprehension in Python which gives the count of numbers and put the number at the specific index
body: <p>Suppose I have a list</p>
  <pre><code>input = [4, 4, 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 2, 2, 2]
  </code></pre>
  <p>This list can contain (repeating) numbers from 0 to n (here n=4).
  Can I generate a list using list comprehension, where the value at index is equal to the count of that number in list a
  For e.g., output list in above scenario would be</p>
  <pre><code>output = [0, 2, 7, 4, 2]
  </code></pre>
  <p>Explanation</p>
  <pre><code>here
  output[0] = 0 #since we don't have any 0 in input list
  output[1] = 2 #since we have two 1's in input list
  output[2] = 7 #since we have seven 2's in input list
  output[3] = 4 #since we have four 3's in input list
  output[4] = 2 #since we have two 4's in input list
  </code></pre>