numdims(method returns the dimensionality of the arraywhich can be obtained from the number of elements in the dims tuple element access access to individual elements within an - array requires an -tuple or multicomponent subscriptone for each dimension as indicated in section when multi-component subscript is specified ( [ , ])python automatically stores the components in tuple in the order listed within the brackets and passes the tuple to the ndxtuple argument the contents of the ndxtuple are passed to the computeindex(helper method to compute the index offset within the - storage array the use of the helper method reduces the need for duplicate code that otherwise would be required in both element access methods the setitem operator method can be implemented in similar fashion the major difference is that this method requires second argument to receive the value to which an element is set and modifies the indicated element with the new value instead of returning value computing the offset the computeindex(helper methodshown in lines - of listing implements equation which computes the offset within the - storage array the method must also verify the subscript components are within the legal range of the dimension lengths if they are validthe offset is computed and returnedotherwisenone is returned to flag an invalid array index by returning none from the helper method instead of raising an exception within the methodbetter information can be provided to the programmer as to the exact element access operation that caused the error applicationsales reports lazymartinc is small regional chain department store with locations in several different cities and states the company maintains collection of sales records for the various items sold and would like to generate several different types of reports from this data one such reportfor exampleis the yearly sales by storeas illustrated in figure on the next pagewhile others could include total sales across all stores for specific month or specific item the sales data of the current calendar year for all of lazymart' stores is maintained as collection of entries in text file for examplethe following illustrates the first several lines of sample sales data text file