[Python (py3) code]
Usingimport sys, import stdarray,andimport random,create a code thataccepts inputfrom a text file, add matrices, andprints outputto a text file. Usematrix.py andmain.pymodules.Note:When Matrix A and Matrix B are ordered to be added but they have unequal dimensions,print "Matrix addition cannot be performed; dimensions are unequal."Please annotate significant parts.
Format of the input from text file:First Line: type of operation (add)Second Line: matrix A dimension (example: if 3 rows and 2 columns, type3 2)Third Line: matrix A elementsFourth Line: matrix B dimensionFifth Line: matrix B elementsSample input 1:add2 253 -47 312 267 2-34 6
Sample output 1:120 -2-27 37
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here