import numpy as np def sum_matrix(N): my_matrix = *** return *** print(sum_matrix(5)) print(sum_matrix(10)) print(sum_matrix(15)) Create in Numpy a diagonal matrix with elements from N to 0. Count the sum of its values on the diagonal.
import numpy as np def sum_matrix(N): my_matrix = np.diag(np.arange(N, 0, -1)) return my_matrix.sum() sum_matrix(5) sum_matrix(10) sum_matrix(15)