sets and maps store- accumulate the total sales for the given store total iterate over item for in rangesalesdata length( )iterate over each month of the item for in rangesalesdata length( )total +salesdata[simreturn total assuming our view of the data as collection of spreadsheetsthis requires traversing over every element in the spreadsheet containing the data for the given store if store equals this is equivalent to processing every element in the spreadsheet shown at the front of figure two nested loops are required since we must sum the values from each row and column contained in the given store spreadsheet the number of rows (dimension number and columns (dimension number can be obtained using the length(array method total sales by month nextsuppose we want to compute the total sales for given month that includes the sales figures of all items in all stores sold during that month this value can be computed using the following functioncompute the total sales of all items in all stores for given month def totalsalesbymonthsalesdatamonth )the month number must be offset by month accumulate the total sales for the given month total iterate over each store for in rangesalesdata length( )iterate over each item of the store for in rangesalesdata length( )total +salesdata[simreturn total this timethe two nested loops have to iterate over every row of every spreadsheet for the single column representing the given month if we use this function to compute the total sales for the month of januarythe elements of the - array that will be accessed are shown by the shaded area in figure (atotal sales by item another value that we can compute from the sales data in the - array is the total sales for given itemwhich includes the sales figures for all months and from all stores this is computed by the following function