Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello. I need help putting the below into PYTHON coding language: A supermarket

ID: 3806475 • Letter: H

Question

Hello. I need help putting the below into PYTHON coding language:

A supermarket wants to reward its best customer of each day, showing the customer’s name on a screen in the supermarket. For that purpose, the customer’s purchase amount is stored in a list and the customer’s name is stored in a corresponding list. Implement a function

Def nameOfBestCustomers(Sales, customers, topN)

That returns the name of the customer with the largest sale and displays the top customers, that is the topN customer with the largest sales, where topN is a value that the user of the program supplies. The program prompts the cashier to enter all the prices and names, adds them to two lists, calls the function that you implemented, and displays the results. Use a price of 0 as a sentinel.

If there were fewer than topN customers, include all of them.

Explanation / Answer

PROGRAM CODE:

def nameOfBestCustomers(Sales, customers, topN):
   for i in range(0, len(Sales)):
       for j in range(0, len(Sales)):
           if Sales[i] > Sales[j]:
               temp = Sales[j];
               Sales[j] = Sales[i];
               Sales[i] = temp;
               tempName = customers[j];
               customers[j] = customers[i];
               customers[i] = tempName;
   count = topN;
   if count > len(Sales):
       count = len(Sales);
   print(' Customer with largest Sales: ', customers[0]);
   for i in range(0, count):
       print((i+1),'. ', customers[i], ' ', Sales[i]);
      
  
isContinue = 'y';
Sales = [];
Customers = [];
countOfCust = 0;
while isContinue == 'y':
   Sales.append(float(input(' Enter the Sales amount: ')));
   Customers.append(input(' Enter the customer name: '));
   isContinue = input(' Do you want to continue?(y/n)');
countOfCust = int(input(' Enter N: '));
nameOfBestCustomers(Sales, Customers, countOfCust);

OUTPUT: