Hard
Matrix Class
Write a
Matrix class holding rows of numbers, with add(other), transpose() and a __str__ that prints rows on separate lines. Read two r×c matrices and print their sum and then the transpose of the sum.Input
r c, then r lines for A, then r lines for B.
Output
The sum, a blank-free separator line '--', the transpose.
Sample 1
Input
2 2 1 2 3 4 5 6 7 8
Output
6 8 10 12 -- 6 10 8 12
Sample 2
Input
1 3 1 2 3 3 2 1
Output
4 4 4 -- 4 4 4
Output appears here