Answers for "sum of diagonal numpy"

-1

sum of diagonal numpy

arr= np.arange(16)
arr= np.reshape(arr,(4,4))

a=np.diagonal(arr, 0,0,1)

result=sum(a)
print(result)
Posted by: Guest on November-12-2020

Python Answers by Framework

Browse Popular Code Answers by Language