title: Expanding tuple into number repeated X times in a list (python)
body: <p>This seems simple, but I can't figure it out. I have ten categories and scores assigned to each of them. In an intermediate step, I am storing results as ["score", repeats] pairs, as in:</p>
  
  <pre><code>[20,3]
  [40,7]
  [50,2]
  </code></pre>
  
  <p>...</p>
  
  <p>What I want to do in the end is expand these pairs into repeats of numbers, then merge and average to get one score like this:</p>
  
  <pre><code>[20,20,20]
  [40,40,40,40,40,40,40]
  [50,50]
  </code></pre>
  
  <p>Merged:</p>
  
  <pre><code>[20,20,20,40,40,40,40,40,40,40,50,50]
  
  sum([20,20,20,40,40,40,40,40,40,40,50,50],0.0)/12
  </code></pre>
  
  <p>Final result (average): 37</p>
  
  <p>So how do I accomplish step #2, where I expand the scores X times for each pair? I could do this if they were strings, but there has to be a numeric way to do it.</p>