LearnPy Hub
← NumPy problems
Medium

Row and Column Sums

Read r, c and an r×c grid. Print the column sums (axis=0) and then the row sums (axis=1), each as a list.

Input

r c, then r lines.

Output

Two lists.

Sample 1

Input
2 3
1 2 3
4 5 6
Output
[5, 7, 9]
[6, 15]

Sample 2

Input
1 1
7
Output
[7]
[7]
solution.py
Output appears here
Row and Column Sums · Python practice problem · LearnPy Hub