Question: 3 . Implement row _ sums Read the specification of the function row _ sums in the module funcs. Implement this function according to its

3. Implement row_sums
Read the specification of the function row_sums in the module funcs. Implement this function according to its specification. Note that this function returns a list of numbers. You are going to want to use the double-accumulator pattern for this problem. The outside for-loop accumulates the list to return. Inside of the for-loop you have an accumulator (and another for-loop) to accumulate the sum for each row.
When you have implemented the function, test your answer with the test script before moving on to the next function.
def row_sums(table):
"""
Returns a list that is the sum of each row in a table.
This function assumes that table has no header, so each row has only numbers in it.
Examples:
row_sums([[0.1,0.3,0.5],[0.6,0.2,0.7],[0.5,1.1,0.1]]) returns [0.8,1.5,1.7]
row_sums([[0.2,0.1],[-0.2,0.1],[0.2,-0.1],[-0.2,-0.1]]) returns [0.3,-0.1,0.1,-0.3]
Parameter table: the nested list to process
Precondition: table is a table of numbers. In other words,
(1) table is a nested 2D list in row-major order,
(2) each row contains only numbers, and
(3) each row is the same length.
"""

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!