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