title: Sum of specific elements of a list in python
body: <blockquote>
    <p>What question is asking for is a list that contains the number of all occurrences of the number 2 for a given index. </p>
  </blockquote>
  
  <p>For example:</p>
  
  <pre><code>[1, 2, 2]
  [2, 1, 1]
  [1, 1, 2]
  </code></pre>
  
  <p>Gives</p>
  
  <pre><code>[1,1,2]
  </code></pre>
  
  <p>While </p>
  
  <pre><code>[2, 2, 2]
  [2, 1, 2]
  [2, 2, 1]
  </code></pre>
  
  <p>Gives:</p>
  
  <pre><code>[3,2,2]
  </code></pre>