Hi Everybody, I have a question about the C1-W2 Assignment.

Here is my AddRows function, which passes all the tests:

def AddRows(M, row_num_1, row_num_2, row_num_1_multiple):

M_new = M.copy()

# multiply row_num_1 by row_num_1_multiple and add it to the row_num_2,

# exchanging row_num_2 of the matrix M_new with the result

M_new[row_num_2] = (row_num_1_multiple * M_new[row_num_1]) + M_new[row_num_2]

return M_new

However, when I use this function to to row operations in Exercise 4, it keeps resulting in row_num_1 getting added to when I only want to to add it to another row. In other words, the AddRows function results in adding the result to both rows in the parameter, not only to the intended “exchange” row. I used exactly the same syntax as last week’s lab where it works as intended, but without making this function work properly everything else fails.

Does anybody have any insight as to how to preserve the original row values of row_num_1 while adding them to another row as in Gaussian elimination?

Thanks