title: How to do a loop inside of a loop in python
body: <p>Currently I have a program which goes through a list of vector coordinates and performs a simple math function on the two vectors, but I want to make a loop inside of a loop to be able to have more control on what happens, this is my program so far:</p>
  
  <pre><code>import operator
  import numpy as np
  b = 0
  a = 1
  for a in range(0,56): 
      vector1 = (int(l[b][0]),int(l[b][1]),int(l[b][2]))
      vector2 = (int(l[a][0]),int(l[a][1]),int(l[a][2]))
  #print vector1
  #print vector2
      x = vector1
      y = vector2
  vector3 = list(np.array(x) - np.array(y))
  #print vector3
      dotProduct = reduce( operator.add, map( operator.mul, vector3, vector3))
      print dotProduct
      a += 1
  </code></pre>
  
  <p>But what I want is that once a hits 56 and does its final run through, I want B to add 1 and a to reset back to zero, and redo the loop of operations until b goes up to 55.</p>
  
  <p>Desired output:
  example of coordiantes:</p>
  
  <p>Cu 46.7176 27.1121 27.1121</p>
  
  <p>Cu 43.2505 36.0618 32.4879</p>
  
  <p>Cu 43.3392 36.0964 28.9236</p>
  
  <p>Cu 43.2509 37.8362 27.1091</p>
  
  <p>Cu 34.4872 14.1794 16.5767</p>
  
  <p>Cu 34.4103 16.0364 14.3521</p>
  
  <p>Cu 32.7006 14.069 14.412  </p>
  
  <p>and I want the first coordinate to perform the dot product with everything under it, and go back and then start with the second coordinate and perform dot product with everything under it, and so on..</p>