you will be writing a paython program for a company to load saved sales data from a file and view certain information about each customer. First, create a file in your project named sales.txt and add the following data: Steve123 11/23/21 50.41 Customer1 11/23/21 500 JanetG 1/2/22 25.37 Customer1 2/15/22 250 Steve123 3/17/22 18.75 UserName 4/12/22 2.50 FrankF 5/17/22 30 FrankF 6/10/22 42.50 JanetG 12/15/22 25 FrankF 1/23/23 50.15 Each line contains information about a single sale: The username of the customer, the date of the sale, and the amount of the sale. Aside from main, your program should include the following two functions: load_data: Creates a dictionary in which every key is a customer name, and every value is a list containing the amount of each of their sales. Returns the dictionary. print_customer_info: Accepts the dictionary and a customer name as parameters. Prints out the following information about the given customer in a nicely formatted way: the number of sales they made, the total of all their sales added up, and the average amount per sale. In your program's main function, call load_data and assign the returned dictionary to a variable. Then, continually ask the user which customer they would like to see information for (or if they'd like to quit). If the customer does not exist in the dictionary, the program shouldn't crash (you can avoid this in whichever way you prefer). Otherwise, call the print_customer_info function passing the dictionary and the name.
, you will be writing a paython
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images