We can use a nested list to represent a Matrix during initialization ofĪn object In a nested list, the length of the outer list would be ‘m’Īnd the number of elements the inner lists have would be ‘n’ from matrix import Matrix matrix_list =, , ] matrix1 = Matrix ( 3, 3, matrix_list ) print ( matrix1 ) #Prints: # Operations on Matrices Addition and Subraction To create a matrix, specify the order of the Matrix (mxn) where theįirst argument (m) is the number of rows in the matrix and the second Addition, Multiplication, Division, Subraction operations supportedīetween matrices and between a matrix and a int / floatĬofactor of a given element in the Matrix