I am trying to do matrix multiplication. First i created an empty matrix C and then using for loop I am trying to do matrix multiplication and assign the results to matrix C.
# Matrix Multiplication
A = [[1, 2] , [3, 4]]
B = [[2, 3] , [2, 1]]
n = len(A) # No. of rows
j = len(A[0]) # No. of columns
C =[[]]
for i in range(len(A)):
for j in range(len(A[0])):
C[i][j] = 0
for k in range(len(A)):
C[i][j] = C[i][j] + A[i][k] * B[k][j]
print(C)
I am getting the error "list assignment index out of range".
numpyfor actual matrix processing? Only lists are used in your posted example.