Posts by user129775 • 41 points
2 posts
-
3
votes2
answers2443
viewsA: How to add the main diagonal of a python matrix?
n= 4 m= [[2,6,4,3],[2,4,6,4],[5,1,0,4],[4,5,4,6]] sum_diagonal = sum(m[i][i]for i in range(n)) print(sum_diagonal)
pythonanswered user129775 41 -
1
votes2
answers2443
viewsQ: How to add the main diagonal of a python matrix?
I am developing an algorithm and I want to know if there is a command to add the main diagonal of an array in Python
pythonasked user129775 41