title: TypeError: object of type 'enumerate' has no len()
body: <p>Here is my code:</p>
  
  <pre><code>def twosum(a, t):
      a = enumerate(a)
      f, l = 0, len(a)-1
      while(f &lt;= l):
          if (a[f][1] + a[l][1] == t):
              return [a[f][0], a[l][0]]
          else:
              f += 1
              l -= 1
      return
  
  print(twosum([2, 7, 11, 15], 9)) 
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>TypeError: object of type 'enumerate' has no len()
  </code></pre>
  
  <p>I thought we can treat enumerate objects as lists. I found solutions online that treats enumerate objects like lists. Can anybody please explain why I get this error?</p>