I want this program in python
m = [[1,0,0],
[0,1,0],
[0,0,1]]
n = [[1,2,3],
[2,3,4],
[2,4,1]]
def cofactor(s,j):
p = m.copy()
for i in range(0,len(p)):
p[i].pop(s)
p.pop(j)
return p
cofact = cofactor(2,1)
print(cofact)
print(m)
To give me back this
[[1, 0], [0, 0]]
[[1,0,0],[0,1,0],[0,0,1]]
but instead is giving
[[1, 0], [0, 0]]
[[1, 0], [0, 1], [0, 0]]
And I do not know what am i doing wrong. I need to understand and find my mistake. Thanks.