a[0, 1] + a[0, 2] + a[0, 3] + a[0, 4]
a[1, 0] + a[1, 2] + a[1, 3] + a[1, 4]
a[2, 0] + a[2, 1] + a[2, 3] + a[2, 4]
Replace the diagonal elements of a matrix with sum of other elements in the row in Python