title: building distinct pairs in python
body: <pre><code>productcode = ['apple','orange','melons'] # 1000+ more
  pairs = []
  count = 0
  for xi,x in enumerate(productcode):
      del productcode[xi]
      for yi,y in enumerate(productcode):
          pc2 += 1
          p = (x,y)
          pairs.append(p)
  
  print ("Number of distinct pairs:",pc2)
  </code></pre>
  
  <p>productcode contains over a thousand data items: </p>
  
  <pre><code>apple
  
  orange
  
  grape
  </code></pre>
  
  <p>Expected output:</p>
  
  <pre><code>apple orange
  
  apple grape
  
  orange grape
  </code></pre>
  
  <p>The nested for loops only iterate over half the items in the list (productcode) and therefore I end up with much lesser number of pairs than I expect. Could anyone help explain what I've done wrong, or what is actually happening? </p>