Question: This modifies the table but not sure how to start have reread the specifications several times and I am unsure of how to start. I
This modifies the table but not sure how to start have reread the specifications several times and I am unsure of how to start. I know we will need to use loops and somehow add an extra row because we want a header.
def place_sums(table): """ Modifies the table to add a column summing the previous elements in the row. This function assumes that the table has a header, which means the first row only has strings in it. The later rows are only numbers. This function adds the string 'Sum' to the first row. For each later row, it appends the sum of that row. Example: Suppose that a is [['First','Second','Third'], [0.1,0.3,0.5], [0.6,0.2,0.7], [0.5,1.1,0.1]] then place_sums(a) modifies the table a so that it is now [['First', 'Second', 'Third', 'Sum'], [0.1, 0.3, 0.5, 0.8], [0.6, 0.2, 0.7, 1.5], [0.5, 1.1, 0.1, 1.7]] Parameter table: the nested list to process Precondition: table is a table of numbers with a header. In other words, (1) table is a nested 2D list in row-major order, (2) the first row only contains strings (the headers) (3) each row after the first contains only numbers, and (4) each row is the same length. """ pass
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
