logo CodeStepByStep logo

matrix_add

Language/Type: Python 2D lists

Write a function named matrix_add that accepts a pair of two-dimensional lists of integers as parameters, treats the lists as 2D matrices and adds them, returning the result. The sum of two matrices A and B is a matrix C where for every row i and column j, Cij = Aij + Bij. You may assume that the lists passed as parameters have the same dimensions.

Function: Write a Python function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.