title: How to iterate over two lists without using nested for loops?
body: <p>If a and b are two lists then how can we get c without using nested for loops in python?</p>
  
  <pre><code>a=[1,2,3] 
  b=[4,5,6] 
  c=[(1,4),(1,5),(1,6),(2,4),(2,5),(2,6),(3,4),(3,5),(3,6)] 
  </code></pre>
  
  <p>Let's assume I have to find the sum of all nth term of fibonacci sequence formed by these pairs as the first two numbers, where n is any positive number. 
  In this case for n=3 answer in 63. </p>
  
  <pre><code>&gt;     1 4 5 nth term in 5  1 5 6 nth term in 6  . . . 3 6 9 nth term in 9 
  &gt;            &gt; Sum of all nth term in 63.
  </code></pre>