title: list comprehension to repeat element in a list by element value
body: <p>I can't quite figure out the code to do this, there are similar posts: <a href="https://stackoverflow.com/questions/3925465/repeating-elements-in-list-comprehension">Repeating elements in list comprehension</a></p>
  
  <p>but I want to repeat a value in the list by the value in the list</p>
  
  <pre><code>In [219]:
  
  l = [3,1]
  
  [i for x in range(i) for i in l]
  ---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-219-84d6f25dfd96&gt; in &lt;module&gt;()
        1 l = [3,1]
        2 
  ----&gt; 3 [i for x in range(i) for i in l]
  
  TypeError: 'tuple' object cannot be interpreted as an integer
  </code></pre>
  
  <p>What I want is a list like so:</p>
  
  <pre><code>[3,3,3,1]
  </code></pre>
  
  <p>Also can someone explain the error.</p>
  
  <p>Note I am running python 3.3 here</p>