title: Python, Error or incorrect output in function sum over lists of lists
body: <p>Receiving errors when creating a function to sum a values in a List of Lists</p>
  
  <p>Example:
  Seeking to generate this type of output </p>
  
  <pre><code>listtest = [1,2,3,4,5,6]
  print(sum(listtest)) # output is 21
  </code></pre>
  
  <p>But for a list of lists</p>
  
  <pre><code>listsample = [[1,2,3,4,5],[1,2,5,4,6,7],[7,8,9,5,6]]
  # Desired_output= [15,25,35]
  </code></pre>
  
  <p>I know this can be done and works</p>
  
  <pre><code>listsample = [[1,2,3,4,5],[1,2,5,4,6,7],[7,8,9,5,6]]
  result = list(map(sum,listsample))
  print(result)
  # Desired_output= [15,25,35]
  </code></pre>
  
  <p>How is one to manipulate the sum function to allow it to pass without error within a function?</p>
  
  <p>I've commented on the methods attempted and the outcomes, please un-comment to test or run code. </p>
  
  <pre><code>listsample = [[1,2,3,4,5],[1,2,5,4,6,7],[7,8,9,5,6]]
  import itertools as itr
  def sumrows(ls):
      for i in ls:
          for subls in range(0,len(i)):
              # opt = 0
              # opt = opt + i[subls] # --&gt;&gt; generates output of None
              # return sum(subls for i in range(0,len(i))) # --&gt;&gt; generates unusual output of 0 - I'm not sure how this value is arrived at
              # return list(map(sum, subls)) # --&gt;&gt; generates error " 'int' object is not iterable "
              # return list(i(sum((subls)))) # --&gt;&gt; generates error " 'int' object is not iterable "
              # return list(i(sum(itr.chain.from_iterable(subls))))  # --&gt;&gt; generates error " 'int' object is not iterable "
  
  print("output", sumrows(listsample))
  </code></pre>