sets and maps constructor the constructorwhich is shown in lines - defines three data fieldsdims stores the sizes of the individual dimensionsfactors stores the factor values used in the index equationand elements is used to store the - array used as the physical storage for the multi-dimensional array the constructor is defined to accept variable-length argument as required in the adt definition the resulting tuple will contain the sizes of the individual dimensions and is assigned to the dims field the dimensionality of the array must be verified at the beginning of the constructor as the multiarray adt is meant for use with arrays of two dimensions or more the elements of the multi-dimensional array will be stored in - array the fixed size of the array can be computed as the product of the dimension lengths by traversing over the tuple containing the variable-length argument during the traversalthe precondition requiring all dimension lengths be greater than zero is also evaluated the array class defined earlier in the is used to create the storage array finallya - array is created and assigned to the factors field the size of the array is equal to the number of dimensions in the multi-dimensional array this array will be initialized to the factor values used in equation for computing the element offsets the actual computation and initialization is performed by the computefactors(helper methodwhich is left as an exercise sample instance of the multiarray class is illustrated in figure dims factors elements multiarray figure sample multiarray object for the - array from figure dimensionality and lengths in the multi-dimensional version of the arraythere is no single length value insteadeach dimension of the array has an associated size python' len(function cannot be used for this task since we must specify particular dimension to obtain its size insteadthe length(methodas shown in lines - of listing is used the method first verifies the given dimension index is between and nwhich is the legal range specified in the adt definition the size of the requested dimension is then returned using the appropriate value from the dims tuple the