Question
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
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 nameOfBestCustomers(sales, customers, 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. The program output should be formatted as shown in the Sample Run. Note: You must use at least two functions in your code.
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 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 Enter the number of top customers: 5 Enter the sale amount (x to quit): 900 Enter the customer's name: Alina Enter the sale amount (x to quit): 800 Enter the customer's name: Maria Enter the sale amount (x to quit): x The best 2 customers were Alina Maria
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started