title: Iterating through multiple lists to find the best overall combination
body: <p>I have a bunch of files to iterate over to find the best combination, and would like some advice on how to do it. I have to put
  together a mixed-age "relay" team. We need (exactly) one person from each age. But, we have a max weight that we can't go over. We know
  roughly how much each person will score -- the highest total score wins.</p>
  
  <p>I have all the peeps in files by their age with their name, weight and score, eg the 5.csv file has all the 5yr olds (name,weight,score)</p>
  
  <pre><code>JonnyM,54,20
  SallyR,35,18
  MeganP,33,25
  ...
  </code></pre>
  
  <p>the 6.csv has the 6yr olds with the same format</p>
  
  <pre><code>DaveL,53,30
  NancyP,40,28
  ...
  </code></pre>
  
  <p>etc up to 20.csv.</p>
  
  <p>I suppose I could do this with a lot of typing:</p>
  
  <pre><code>import csv
  maxweight=5000
  bestscore=0
  bestcombo=[]
  f5 = csv.reader(open("5.csv", "r"), delimiter=',')
  f6 = csv.reader(open("6.csv", "r"), delimiter=',')
  ...
  f20 = csv.reader(open("20.csv", "r"), delimiter=',')
  for name5,weight5,score5 in 5f:
      for name6,weight6,score6 in 6f:
  ...
      ...(and a lot more)
          for name20,weight20,score20 in 20f:
              if((weight5+weight6+...weight20)&lt;=maxweight):
                  if((score5+score6+...score20)&gt;bestscore):
                      bestcombo=[name5,name6,...name20]
  </code></pre>
  
  <p>But, there has <em>got</em> to be a better way.  I'm sure its obvious, but I'm also pretty new to python.</p>