Ans. There are two ways to do this. The first method is for the versions of Python that are older than 3.5 –
Z = np.dot(np.ones((4,3)), np.ones((3,2)))
print(Z)
array([[3., 3.],
[3., 3.],
[3., 3.],
[3., 3.]])
The second method is for Python version > 3.5,
Z = np.ones((4,3)) @ np.ones((3,2))
Leave a Reply