Question

In: Computer Science

PYTHON 3 Your team has been hired by the new burgers place called “The hungry snake.”...

PYTHON 3 Your team has been hired by the new burgers place called “The hungry snake.” Per the client, you have the following information: the client’s name, burger’s name, time of the day, and the total bill. By the end of the day, your program will provide the following information:

1. Top three best clients (highest bills)

2. Name of the client with the second-to-last lowest bill

3. Busiest hour of the day (number of clients)

Assumptions

1. Your program will not handle more than 100 clients per day

2. The restaurant only has six types of burgers

3. The restaurant works from 10:00 am until 10:00 pm

Solutions

Expert Solution

CODE

SOLUTION

//OUTPUT

//COPYABLE CODE

f = open("a.csv","w")
input1 = '''clientname, burgername, time_of_the_day, totalbill
david sharmamari,burger1,10:00 am,100
david sharmamari,burger1,11:00 am,100
david sharmamari,burger1,12:00 am,100
david sharmamari,burger1,1:00 pm,100
david sharmamari,burger1,2:00 pm,100
david sharmamari,burger1,3:00 pm,100
sharmi,burger2,10:00 am,300
sharmi,burger2,11:00 am,300
sharmi,burger2,12:00 am,300
sharmi,burger2,12:30 am,300
Hasuu,burger3,12:30 am,500
sharmi,burger3,12:30 am,500
mano,burger4,12:30 am,900
devi,burger4,12:30 am,900
Ranju,burger3,12:30 am,500
mano,burger5,12:30 am,90
devi,burger5,12:30 am,90
Ranjetha,burger5,12:30 am,90
Manogar,burger6,1:30 pm,10
Robertshar,burger6,1:30 pm,10
Manivannan Bahaji Mohammad shar,burger1,12:30 am,500'''
f.write(input1)
f.close()

#coding part
n = 5
f = open("a.csv")
input1 = f.read().split("\n")
f.close()
input1 = input1[1:]
da = []
for i in input1:
da.append(i.split(","))

#print customer details
print("\nclient number for name ",n," is : ",da[n][0])

# longest name with client data
max_name = da[0][0]
for i in da:
if len(i[0]) > len(max_name):
max_name = i[0]
print("\nThe client with the longest name : ",max_name)

# seling burgers
burger_Cnt = {"burger1":0,"burger2":0,"burger3":0,"burger4":0,"burger5":0,"burger6":0}

for i in da:
burger_Cnt[i[1]] = burger_Cnt[i[1]] + 1

burger_Cnt = sorted(burger_Cnt.items(), key=lambda x1: x1[1], reverse=True)
print("\nTop selling burgers are : ")
print("1. ",burger_Cnt[0][0]," with the count of burgers : ",burger_Cnt[0][1])
print("2. ",burger_Cnt[1][0]," with the count of burgers : ",burger_Cnt[1][1])
print("3. ",burger_Cnt[2][0]," with the count of burgers : ",burger_Cnt[2][1])

# 1. top three client
bill_Cnt = {}
for i in da:
if i[0] in bill_Cnt:
bill_Cnt[i[0]] = int(bill_Cnt[i[0]]) + int(i[-1])
else:
bill_Cnt[i[0]] = int(i[-1])
bill_Cnt = sorted(bill_Cnt.items(), key=lambda x1: x1[1], reverse=True)
print("\nTop three Clients :")
print("1. ",bill_Cnt[0][0]," with the bill amount : ",bill_Cnt[0][1])
print("2. ",bill_Cnt[1][0]," with the bill amount : ",bill_Cnt[1][1])
print("3. ",bill_Cnt[2][0]," with the bill amount : ",bill_Cnt[2][1])

# 2. lowest bill
print("\n lowest bill : ",bill_Cnt[-2][0])

# 3. Busiest day
hours_Cnt ={}
for i in da:
hour = i[2].split(":")
hour = hour[0]+ hour[1][-2:]
if hour in hours_Cnt:
hours_Cnt[hour] = int(hours_Cnt[hour]) + 1
else:
hours_Cnt[hour] = 1
hours_Cnt = sorted(hours_Cnt.items(), key=lambda x1: x1[1], reverse=True)
print("\nBusiest day : ",hours_Cnt[0][0]," With number of customers : ",hours_Cnt[0][1])

# Best hour
sales_Cnt = {}
total_Sales = 0
for i in da:
hour = i[2].split(":")
hour = hour[0]+ hour[1][-2:]
if hour in sales_Cnt:
sales_Cnt[hour] = int(sales_Cnt[hour]) + int(i[-1])
else:
sales_Cnt[hour] = int(i[-1])
total_Sales = total_Sales + int(i[-1])

sales_Cnt = sorted(sales_Cnt.items(), key=lambda x1: x1[1], reverse=True)
print("\nBest sales hour : ",sales_Cnt[0], "With the tatal sales in the hour : ",sales_Cnt[0][1])

# total sales
print("\nTotal sales : ",total_Sales)


Related Solutions

a) You have just been hired as the new supervisor of an audit team for a...
a) You have just been hired as the new supervisor of an audit team for a national accounting firm. With four years of experience, you feel technically well prepared for the assignment. However, this is your first formal appointment as a ‘manager.’ Things are complicated at the moment. The team has 12 members of diverse demographic and cultural backgrounds, as well as work experience. There is an intense workload and lots of performance pressure. i. How will this situation challenge...
Suppose that your team has been hired by a high-tech, consumer electronics firm to provide an...
Suppose that your team has been hired by a high-tech, consumer electronics firm to provide an economic analysis of how to price this new product in such a way that maximizes the company's profits. In today's technologically driven world, there are some people who enjoy becoming the first adopters of a new product. Most people, however, seem to hold back to see the development of the product before they jump in. Are there any strategies that the firm can take...
You have just been hired as the new supervisor of an audit team for a national...
You have just been hired as the new supervisor of an audit team for a national accounting firm. With four years of experience, you feel technically well prepared for the assignment. However, this is your first formal appointment as a ‘manager.’ Things are complicated at the moment. The team has 12 members of diverse demographic and cultural backgrounds, as well as work experience. There is an intense workload and lots of performance pressure. i. How will this situation challenge you...
Team Case #3: Rural Utility Your consulting team has been brought in by the Board chairperson...
Team Case #3: Rural Utility Your consulting team has been brought in by the Board chairperson to assist an organization in developing a key leader. The Board is concerned with Audrey, the current senior executive of their rural public utility company with 185 employees. The company is 76% male and 24% female, and their previous executive, Hugh Davis (who retired), had a very collaborative leadership style – a real contrast from Audrey, who is very task-focused and directive. The average...
Your accident  reconstruction team has been hired by the local police   to analyze the following accident. A careless...
Your accident  reconstruction team has been hired by the local police   to analyze the following accident. A careless driver rear-ended a car that was halted at a stop sign.   Just   before impact, the   driver slammed on his brakes, locking   the wheels. The driver   of the struck car had his foot solidly on the brake pedal,   locking his brakes.   The   mass of   the   struck car was 900 kg,   and   that   the   initially moving vehicle   was   1200 kg.   On collision,  the   bumpers  of the two cars meshed....
MGMT 640 GROUP PROJECT Scenario: Your team has been hired to provide financial analysis for a...
MGMT 640 GROUP PROJECT Scenario: Your team has been hired to provide financial analysis for a start-up company, Bobble in Style, which produces customized bobble heads. The bobble heads are made out of less rigid materials and are more true to life than those of competitors. The company inventors, Mr. and Mrs. Lee, are going to pitch their idea to Shark Tank in a few months, but first they need to have a better understanding of the business financials. The...
Scenario: Your team has been hired to provide financial analysis for a start-up company, Bobble in...
Scenario: Your team has been hired to provide financial analysis for a start-up company, Bobble in Style, which produces customized bobble heads. The bobble heads are made out of less rigid materials and are more true to life than those of competitors. The company inventors, Mr. and Mrs. Lee, are going to pitch their idea to Shark Tank in a few months, but first they need to have a better understanding of the business financials. The Lee’s are already creating...
You have been hired as an analyst for Melvin Bank and your team is working on...
You have been hired as an analyst for Melvin Bank and your team is working on an independent assessment of TWINKY, which is a firm that specializes in the production and distribution of ice and glass products in Sweden. Your assistant has provided you with the following data about the company and its industry. You analysis should include intra-company, inter-company, and industry benchmark comparisons. What can you say about the firm's overall management in terms of the following? (Be as...
You have been hired as an analyst for Bank WA and your team is working on...
You have been hired as an analyst for Bank WA and your team is working on an independent assessment of a firm that specializes in the production of freshly imported farm products from New Zealand. Your assistant has provided you with the following data about the company and its industry. Ratio 2019 2018 2017 2019- Industry Average Long-term debt 0.45 0.40 0.35 0.35 Inventory Turnover 62.65 42.42 32.25 53.25 Depreciation/Total Assets 0.25 0.014 0.018 0.015 Days’ sales in receivables 113...
1. You have been hired as an analyst for an advisory company and your team is...
1. You have been hired as an analyst for an advisory company and your team is working on an independent assessment of G-Aviation. G-Aviation is a firm that specializes in the production of aviation material. Your assistant has provided you with the following data for G-Aviation and their industry. Ratio 2019 2018 2017 2019- Industry Average Long-term debt 0.45 0.40 0.35 0.35 Inventory Turnover 62.65 42.42 32.25 53.25 Depreciation/Total Assets 0.25 0.014 0.018 0.015 Days’ sales in receivables 113 98...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT