Use a list of lists to solve the following problem. A company has four salespeople (1 to 4) who sell five different products (1 to 5). Once a day,
each salesperson passes in a slip for each different type of product sold. Each slip contains:
a) The salesperson number.
b) The product number.
c) The number of that product sold that day.
Thus, each salesperson passes in between 0 and 5 sales slips per day. Assume that the information from all of the slips for last week is available.
Write a program that will read all this information for last month’s sales and summarize the total sales by salesperson by product.
All totals should be stored in list sales. After processing all the information for last week, display the results in tabular format, with each of
the columns representing a particular salesperson and each of the rows representing a particular product. Cross-total each row to get the total sales
of each product for last
week; cross-total each column to get the total sales by salesperson for last week. Your tabular printout should include these cross-totals to the right
of the totaled rows and at the bottom of the totaled columns.
Example use of list of lists:
The above represents 4 slips’ data.
The first item in a sublist is sales person id
The second item in a sublist is the product id
The third item in a sublist is the number of items sold
The number 10 above represents the number of items sold by sales ID 1 for product ID 4.
Note that the elements of a sublist can be accessed by using  with proper index values. All of the list commands are also applicable for sublists too.
Recently Asked Questions
- I need help answering those 2 questions please: · Quality and prevention in healthcare, including the benefits they provide. and also how to
- Why does molten iron that is heated until white hot, the poured into a mold changes its color from yellow to red as it cools?
- Please refer to the attachment to answer this question. This question was created from GOVT2305PublicPolicy1Summer2014. Additional comments: "(1) What role did