title: How to add index into a dict
body: <p>For example, given:</p>
  
  <pre><code>['A', 'B', 'A', 'B']    
  </code></pre>
  
  <p>I want to have:</p>
  
  <pre><code>{'A': [0, 2], 'B': [1, 3]}
  </code></pre>
  
  <p>I tried a loop that goes like; add the index of where the character is found, then replace it with <code>''</code> so the next time the loop goes through, it passes on to the next character. </p>
  
  <p>However, that loops doesn't work for other reasons, and I'm stuck with no idea how to proceed.</p>