Write a Python program to print trace of an array/ matrix


Topic: Write a Python program to print trace of an array/ matrix

Solution

import numpy as np
A = np.array([[4,5,8], [5,5,5], [2,3,6]])
print("Trace of the matrix A: ", np.trace(A))



List all Python Programs