title: Pythonic way to write a loop
body: <p>I have two lists: <code>a = [1, 2, 3]</code> and <code>b = [4, 5, 6]</code>.</p>
  
  <p>I have used two loops in python to subtract each element of <code>b</code> from each element of <code>a</code>.</p>
  
  <pre><code>import numpy as np
  a = [1, 2, 3]
  b = [4, 5, 6]
  p = -1
  result = np.zeros(len(a)*len(a))
  for i in range(0,len(a)):
      for j in range(0,len(a)):
          p = p + 1
          result[p] = a[i] - b[j]
  </code></pre>
  
  <p>My result is correct: <code>result = [-3., -4., -5., -2., -3., -4., -1., -2., -3.]</code>.</p>
  
  <p>However, I would like to know if there is more elegant('pythonic') way to do it.</p>