## how to do matrix multiplication of two matrices in python using numpy

Hello friends in this section we are going to see how to do matrix multiplication of two matrices in python using numpy so let’s see :

``````import numpy as np
a = int(input('enter number of rows'))
b = int(input('enter number of columns'))
enter number of rows2
enter number of columns2
numberlist = list(map(int, input().split()))
1 2 3 4
matrix1 = np.array(numberlist).reshape(a,b)
matrix1
array([[1, 2],
[3, 4]])
c = int(input('enter number of rows'))
d = int(input('enter number of columns'))
enter number of rows2
enter number of columns2
numberlist2 = list(map(int, input().split()))
5 6 7 8
matrix2 = np.array(numberlist2).reshape(a,b)
matrix2
array([[5, 6],
[7, 8]])
res = np.dot(matrix1, matrix2)
res
array([[19, 22],
[43, 50]])
res1 = [email protected]
res1
array([[19, 22],
[43, 50]])
``````

Navin Franklin

github link :navinfranklin (navin franklin) (github.com)

### sachin Pagar I am Mr. Sachin pagar Embedded system engineer, the founder of Pythonslearning, a Passionate Educational Blogger and Author, who love to share the informative content on educational resources.

### sachin Pagar

I am Mr. Sachin pagar Embedded system engineer, the founder of Pythonslearning, a Passionate Educational Blogger and Author, who love to share the informative content on educational resources.