Medium
Identity and Trace
Read n and then an n × n grid of integers. Print the trace (sum of the diagonal) of the grid, then the grid plus the identity matrix
np.eye(n, dtype=int), row by row.Input
n, then n rows.
Output
n + 1 lines.
Sample 1
Input
2 1 2 3 4
Output
5 2 2 3 5
Sample 2
Input
1 5
Output
5 6
Output appears here