Hi

I tried to solve the Week 5 problem with list. Somehow, i am unable to get the correct response.

Below is my snippet.

Can someone help me crack it!

def square_matrix_power(A,n):

C=[item[:] for item in A]

temp=[item [:] for item in A]

for num in range(int(n)-1):

for i in range(len(A)):

for j in range(len(A)):

for k in range(len(A)):

C[i][j] += A[i][k]*temp[k][j]

temp = [item[:] for item in C]

return C

num= input(‘Input value of n :’)

square_matrix_power(A,num)