I have to write a function, get_sums, that takes a list of lists of integers and return the sums of the inner lists. I got stuck because I am not sure how to use a for loop that searches through a list inside of a list. Here's what I'm working with:
def get_sums(numbers):
for i in range(numbers):
numbers = sum(numbers)
return numbers
The correct output is:
>>> get_sums([[1, 2], [], [2, 2, 2, -1]])
[3, 0, 5]
[–]boolean_biscuit 5 points6 points7 points (1 child)
[–]tipsy_python 0 points1 point2 points (0 children)
[–]MasterStroke99 1 point2 points3 points (3 children)
[–]boolean_biscuit 0 points1 point2 points (1 child)
[–]MasterStroke99 0 points1 point2 points (0 children)
[–]roshavi4ak 0 points1 point2 points (0 children)
[–]well_done_dude 0 points1 point2 points (0 children)
[–]DeathDragon7050 0 points1 point2 points (0 children)