gets the contents of the element at position [ijdef __getitem__selfndxtuple )assert len(ndxtuple= "invalid number of array subscripts row ndxtuple[ col ndxtuple[ assert row > and row self numrows(and col > and col self numcols()"array subscript out of range the darray self _therows[rowreturn the darray[colsets the contents of the element at position [ ,jto value def __setitem__selfndxtuplevalue )assert len(ndxtuple= "invalid number of array subscripts row ndxtuple[ col ndxtuple[ assert row > and row self numrows(and col > and col self numcols()"array subscript out of range the darray self _therows[rowthe darray[colvalue basic operations note that the size of the array that is passed as arguments to the constructor is not saved in data fields the numrows(method can obtain the number of rows by checking the length of the main arraywhich contains an element for each row in the - array to determine the number of columns in the - arraythe numcols(method can simply check the length of any of the - arrays used to store the individual rows the clear(method can set every element to the given value by calling the clear(method on each of the - arrays used to store the individual rows this is easily done by iterating over the array stored in therows element access access to individual elements within an - array requires -tuple or twocomponent subscriptone for each dimension in mathematicsthe -tuple subscript is generally notated as xr, in modern programming languagesa -tuple subscript is given either as [ ][cor [ ,cin pythonwe can use the latter notation in conjunction with the getitem and setitem subscript operators this will allow for more natural use of the two-dimensional array instead of having to invoke named method the python subscript operator method getitem which is shown in lines - takes single index argument as specified in the method definition this does not restrict the subscript to single index valuehowever when multicomponent subscript is specified ( [ , ])python automatically stores