Search for question
Question

Exercise B: "Matrix Addition"

For this exercise you will design and implement a function that takes two matrix arguments and

computes their sum (if and only if a sum can actually be computed, returning an empty list

otherwise). Two matrices can only be added together if they have exactly the same dimensions. If

the dimensions are acceptable, then the matrix sum will have the same dimensions as either of the

operands, and the value of each element in the matrix sum is itself the sum of the corresponding

elements in the operand matrices. And although it does makes sense to test rectangularity before

attempting addition, you need not perform this step (since you did it above).

In order to complete this task, you will need to:

• ensure you know how matrix addition can be performed²

Your submission for this exercise:

• must be a source code file with filename 'comp1405_f22_#########_tutorial_07_b.py'

must return an empty list if the two operands (i.e., the arguments) have different dimensions

must create a new matrix that holds the sum (without overwriting either of the arguments)