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.
def sum_matrix(N): my_matrix = np.diagonal(np.linspace(N, 0, N)) return my_matrix.sum() print(sum_matrix(5)) print(sum_matrix(10)) print(sum_matrix(15))