title: sum of nested list in Python
body: <p>I try to sum a list of nested elements</p>
  
  <p>e.g, <code>numbers=[1,3,5,6,[7,8]]</code> should produce <code>sum=30</code></p>
  
  <p>I wrote the following code :</p>
  
  <pre><code>def nested_sum(L):
      sum=0
      for i in range(len(L)):
         if (len(L[i])&gt;1):
            sum=sum+nested_sum(L[i])
         else:
            sum=sum+L[i]
      return sum
  </code></pre>
  
  <p>The above code gives following error: </p>
  
  <blockquote>
    <p>object of type 'int' has no len()</p>
  </blockquote>
  
  <p>I also tried <code>len([L[i]])</code>, still not working.</p>
  
  <p>Anyone can help? It is Python 3.3</p>