Question: In Python, Below you will find the U.S. Advance Monthly Sales for Retail and Food Services for 2023. This data can be found in the

In Python, Below you will find the U.S. Advance Monthly Sales for Retail and Food Services for 2023. This data can be found in the file called Sales_data.txt. The total sales estimates are shown in millions of dollars and are based on data from the Advance Monthly Retail Trade Survey, Monthly Retail Trade Survey.

 


Write a program that reads the sales data from the file and store it in two different lists. Store the kind of business into a one-dimensional list and then store the related sales data into a two-dimensional list. The data is separated by tabs (t). Then your program calculates and displays the following information:

  • the total retail and food services for each column field (e.g. 7 month total, Jul, Jun, and May). Make sure to remove the elipses ("...") from the kind of business. The total for each are as follows:
Kind of business7 Month TotalJulJunMay
Retail & food services total
4,746,465702,904705,873725,602
  • List the kind of business, and all relevant information, that had the highest level of sales.
  • List the kind of business, and all relevant information, that had the second highest level of sales.
  • List the kind of business, and all relevant information, that had the lowest level of sales.
  • List the kind of business, and all relevant information, that had the second lowest level of sales.
  • Write all of the above information out to a file titled "student_name_sales_analysis.txt" (substituting your name for student_name). Also include appropriate labels in your output. For example, write the "kind of business" description and along with "had the highest sales of" and then write the value that represents the highest level of sales.

The purpose of this assignment is to practice working with files and lists.

Cant use lambda for sort. 

 

Sales_data.txt:

Motor vehicle & parts dealers ........ 932432.00 136399.00 140447.00 143058.00  
Furniture & home furn. stores ......... 77532.00 10741.00 11294.00 11283.00  
Electronics & appliance stores ....... 49962.00 7209.00 7379.00 7250.00  
Building material & garden eq. &  supplies dealers ........ 295266.00 42308.00 46507.00 50940.00  
Food & beverage stores ........ 565154.00 83902.00 81829.00 83999.00  
Health & personal care stores ...... 245194.00 35031.00 36077.00 36718.00  
Gasoline stations ............ 376247.00 57101.00 56313.00 56733.00  
Clothing & accessories  stores .......... 166432.00 25124.00 24746.00 26557.00  
Sporting goods, hobby, musical instrument, & book stores ....... 55748.00 8482.00 8629.00 8350.00  
General merchandise stores ...... 487768.00 72725.00 72555.00 74209.00  
Miscellaneous store retailers ...... 105883.00 15629.00 16653.00 16998.00  
Nonstore retailers ......... 763858.00 113647.00 110419.00 115401.00  
Food services & drinking places ....... 624989.00 94606.00 93025.00 94106.00

Step by Step Solution

3.38 Rating (157 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To write a Python program to read the sales data from the file and s... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!