Question

PYTHON ONLY A store wants to reward its best customer of each day by showing the...

PYTHON ONLY

A store wants to reward its best customer of each day by showing the customer's name on a screen in the store. To do this they store the customers' amount of purchase and their names in two corresponding lists. Implement a function:

def bestCustomer(sales, customer)

that returns the name and sales amount of the customer with the largest sales for the day.

**Write a program the prompts the manager to enter all sales and customer names (in two lists) and displays the result. Use the sales amount of 0 as the sentinel value.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def Customer(sales, customer) :
    maxIndex = -1
    for i in range(len(sales)):
        if(sales[maxIndex] < sales[i]):
            maxIndex = i
    return maxIndex

def main():
    salesList = []
    namesList = []
    while(True):
        sales = float(input('Enter sales(0 to exit entering): '))
        if(sales == 0):
            break
        name = input('Enter name: ')
        salesList.append(sales)
        namesList.append(name)
    index = Customer(salesList, namesList)
    if(index == -1):
        print("No customers found")
    else:
        print("Highest sales =",salesList[index],", name=",namesList[index])

main()

Add a comment
Know the answer?
Add Answer to:
PYTHON ONLY A store wants to reward its best customer of each day by showing the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT