title: Cross product of sets using recursion
body: <p>I wrote the following recursive routine to compute cross product of two sets.</p>
  
  <pre><code>def combine(input1,input2,output):
      if len(input2)==0:
          return output
      else:
         for num in input1:
             output.append((num,input2[0]))
         combine(input1,input2[1:],output)
  
  input1=[1 2 5]
  input2=[2 3]
  output=[(1,2), (1,3), (2,2),(2,3),(5,2),(5,3)]
  </code></pre>
  
  <p>Is it possible to make the recursion better, for example removing the loop in else and trying to do in same function. I'm looking at different ways of solving the problem.</p>
  
  <p>Edit: Not looking for a solution with something in-built. Looking for how can I do recursion differently, and not use itertools.product.</p>