Cumulation Please implement a python program to cumulate row-wise sums, column-wise sums, and total sum of input matrix of positive integers incrementally (i.e., without storing input matrix if the...

Cumulation

Please implement a python program to cumulate row-wise sums, column-wise sums, and total sum of input matrix of positive integers incrementally (i.e., without storing input matrix if the matrix is huge).


Your program should read all t3*.dat in the same directory as your p3.py, and generate output for each t3*.dat as the example below. You need handle whitespace as the whitespace convention and handle errors. Possible errors are:


1) input is not positive integers, and


2) number of columns are not the same for all rows.


If a t3*.dat file contains errors, you need to print error message (e.g., “ERROR: t39.dat is not in correct format”) and exit from current file and try next file if there is one. You need to create all possible files to make sure your program works.









Input Example:


 1   2


 3   4


 5   6









Output Example:


 1   2   3


 3   4   7


 5   6  11


 9  12  21







May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here