id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

chanr@sfusd.edu > nested_sum
prev  |  next  |  chance

Write a function called nested_sum that takes a list of lists of integers and adds up the elements from all of the nested lists. For example: >>> t = [[1, 2], [3], [4, 5, 6]] >>> nested_sum(t) 21


nested_sum([[1, 2], [3], [4, 5, 6]]) → 21
nested_sum([[1, 2, 3, 4, 5, 6]]) → 21
nested_sum([[1, 2]]) → 3

...Save, Compile, Run (ctrl-enter)

def nested_sum(t):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 101 Post-solution available

Copyright Nick Parlante 2017 - privacy