title: Sum all the possible combination of elements in a list
body: <p>In Python, I am trying to add all of the different combinations of the elements in a list of <code>N</code> lists, where <code>N</code> is a variable. Specifically, I'm working with a list containing N copies of the list <code>[1, 2, 3, 4, 5, 6]</code>. </p>
  
  <p>So let's assume <code>N = 3</code>. I want to cycle through the first list, adding:</p>
  
  <pre><code> 6 + 6 + 6
   5 + 6 + 6
   ...
   1 + 6 + 6`
  </code></pre>
  
  <p>then increment the second guy once and start adding:</p>
  
  <pre><code>6 + 5 + 6
  5 + 5 + 6
  ...
  1 + 1 + 1  # ultimately to
  </code></pre>
  
  <p>after of course I increment the third guy. This specific example can be done with 3 nested for loops, but of course, I need the number of loops to change. I search around the web and this forum for answers and wasn't quite able to grasp what I should do. People have been saying to use recursive functions, but I've never even heard of that until I looked this up. So it's kind of hard to grasp.</p>