title: In Python, loop for don't "save" items with same value in a list
body: <p>Saludos.</p>
  
  <p>I want to sums even index of a list, and i do it works normally with every list, BUT when if the passed list like argument have a duplicated item, the code dont work like it should.</p>
  
  <p>example, I have this code:</p>
  
  <pre><code>def sumar_indices_pares(array):
      """
          sums even-indexes elements 
      """
      suma = []
      while array == []:
          return 0
      for i in array:
          if array.index(i) % 2 == 0 :
              suma.append(i)
      return sum(suma)
  </code></pre>
  
  <p>if i pass like argument the next:</p>
  
  <pre><code>   sumar_indices_pares([1,2,3,4,5])    # give 9 and this is ok
  </code></pre>
  
  <p>But, when i put like argument a list with duplicated items, the loop 'for' iterate and when its over index [1] like is not even ("Par" in spanish) obviously don't sums that index but when the loop reach a even index but with the same value of previous index the code don't sums the even index, example:</p>
  
  <pre><code>sumar_indices_pares([1,2,3,4,2])   # it gives 4 and should be 6 because (1+3+2) = 6 
  </code></pre>
  
  <p>so, the first index with value of 2 is not even so  don't sums that index, but should sums the next index with value of 2 because is a even index.</p>
  
  <p>Note: argument list empty will return 0, that part is ok ;).</p>
  
  <p>Any Solution? Thanks.</p>