Question: In Python, create the Retail Store Application. A retail store wants to know its top customers of each week, that is, the first topN customers

In Python, create the Retail Store Application. A retail store wants to know its top customers of each week, that is, the first topN customers with the largest sales, where topN is a value that the user of the program supplies. Implement a function def nameOfBestCustomer(sales, customer, topN) that returns the names of the topN customers with the largest sales. The application prompts the user to enter a value for topN. Then it asks for all prices and names, calls the function that you implemented, and displays the results. If there were fewer than topN customers entered by the user, the application should output all the customers entered. Use character x as a sentinel.

Sample Run:

Enter the number of top customers: 2

Enter the sale amount (x to quit): 400

Enter the customer's name: Anna

Enter the sale amount (x to quit): 200

Enter the customer's name: John

Enter the sale amount (x to quit): 500

Enter the customer's name: Tom

Enter the sale amount (x to quit): x

The best 2 customers were:

Tom

Anna

Sample Run:

Enter the number of top customers: 3

Enter the sale amount (x to quit): 100

Enter the customer's name: Bianca

Enter the sale amount (x to quit): 700

Enter the customer's name: Carlos

Enter the sale amount (x to quit): 350

Enter the customer's name: Jason

Enter the sale amount (x to quit): 450

Enter the customer's name: Maria

Enter the sale amount (x to quit): x

The best 3 customers were:

Carlos

Maria

Jason

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!