I didn’t Understood the Solution given to the exercise problem on List. Didn’t even understood why we used the `output`

&`temp`

variable and the 4 matrices ie. output[0][0] = A[0][0] *temp… modified from line 4 of def function. It’s going very difficult for me to understand. Please help.

Can you please post the question and solution here?

So that it’ll be easy for people to refer here itself.

Which Solution? I am only asking for solution xd:)

@saroteshubham1

From your statement “4 matrices ie. output[0][0] = A[0][0] *temp”, I assume that you are not aware of how matrix multiplication work. If that is the case, then I would suggest you read about how matrix multiplication works. Once you do that the solution will be clear.

Variable ‘output’ is the variable where the result of the matrix product will be stored. Variable ‘output’ will change with every multiplication.

Elements of the variable ‘output’ change while we are calculating the product. So it cannot be one of the p[erand. Hence we have to use variable ‘temp’ as an intermediary variable to store the transient ‘output’ variable.