LearnPy Hub
← NumPy problems
Hard

Diagonals

Read n and an n×n grid. Print the main diagonal as a list (np.diag), its sum (np.trace), and the grid's transpose one row per line.

Input

n, then n lines.

Output

Lines.

Sample 1

Input
2
1 2
3 4
Output
[1, 4]
5
1 3
2 4

Sample 2

Input
1
5
Output
[5]
5
5
solution.py
Output appears here
Diagonals · Python practice problem · LearnPy Hub