title: TypeError: can't multiply sequence by non-int of type 'float' when multiplying an integer with a list of integers
body: <p>My code:</p>
  <pre><code>import numpy as np
  import sympy as sym
  
  df = [0.99833714, 0.96852   , 0.95101663, 0.92618755]
  mat = list(np.arange(1,5)/2)
  
  def task2(df,mat,comp):
      &quot;&quot;&quot;
      inputs:
      df - list with discount factors
      mat - list with respective maturities
      comp - either a positive integer for compounding frequency per year or 0 for continuous compounding
      returns: numpy array with spot rates (in decimals p.a.) in the same order as inputs
      &quot;&quot;&quot;
      
      if comp &gt; 0:
          rate = comp*([x for x in df]**(-1/comp*[y for y in mat])-1)
      else:
          rate = -(1/[y for y in mat])*np.log([x for x in df])
      
      rate.asarray()
      
      return rate
  </code></pre>
  <p>This is the error I get when playing task2(), I don't understand why this yields an error and I couldn't find anything related to it on StackOverflow or elsewhere:</p>
  <pre><code>---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-102-430bc9fc5d7f&gt; in &lt;module&gt;
  ----&gt; 1 print(task2(df,mat,2))
        2 print(task2(df,mat,0))
  
  &lt;ipython-input-100-5b721054deb4&gt; in task2(df, mat, comp)
       16 
       17     if comp &gt; 0:
  ---&gt; 18         rate = comp*([x for x in df]**(-1/comp*[y for y in mat])-1)
       19     else:
       20         rate = -(1/[y for y in mat])*np.log([x for x in df])
  
  TypeError: can't multiply sequence by non-int of type 'float'
  
  </code></pre>
  <p>Can someone tell me, why I get this error, if `comp is surely an integer?</p>