import numpy as np x = np.random.randn(3, 6) # imagine: 3 rows, 6 columns y = np.random.randn(6, 4) # imagine: 6 rows, 4 columns — notice 6 matches 6! result = np.zeros((3, 4)) # the result will be 3 rows, 4 columns for i in range(len(x)): # walk through every row of x for j in range(len(y[0])): # walk through every column of y for k in range(len(y)): # walk along the row of x, and down the column of y, together result[i, j] += x[i, k] * y[k, j] print(result) __ __