To write a python program for finding the inverse of a matrix
Import numpy as np
Create two empty lists and two variables for getting the values from the user.
Create a nested for loop and iterate the values
Find the inverse using np.linalg.inv(result)
Print the values
import numpy as np
list1,list2=[],[]
A,B=int(input()),int(input())
for i in range(A):
for j in range(B):
value=int(input())
list1.append(value)
list2.append(list1)
list1=[]
print(list2)
result=np.array(list2)
inverse=np.linalg.inv(result)
print(inverse)
Thus the program is written and executed for finding the inverse of a matrix