Carly's Clippers: Prices and Cuts
Carly's Clippers: Prices and Cuts
You are the Data Analyst at Carly’s Clippers, the newest hair salon on the block. Your job
is to go through the lists of data that have been collected in the past couple of weeks.
You will be calculating some important metrics that Carly can use to plan out the
operation of the business for the rest of the month.
● last_week: the number of purchases for each hairstyle type in the last week.
For example, The hairstyle "bouffant" has an associated price of 30 from the prices list,
and was purchased 2 times in the last week as shown in the last_week list. Each of
these elements are in the first index of their respective lists.
First, let’s sum up all the prices of haircuts. Create a variable total_price, and set
it to 0
2. Loop through the prices list and add each price to the variable total_price.
3. After your loop, create a variable called average_price that is the total_price
divided by the number of prices.
You can get the number of prices by using the len() function.
4. Print the value of average_price so the output looks like:
5. That average price is more expensive than Carly thought it would be! She wants
to cut all prices by 5 dollars.
Use a list comprehension to make a list called new_prices, which has each
element in prices minus 5.
6. Print new_prices.
Revenue:
7. Carly really wants to make sure that Carly’s Clippers is a profitable endeavor. She
first wants to know how much revenue was brought in last week.
9. Add the product of prices[i] (the price of the haircut at position i) and
last_week[i] (the number of people who got the haircut at position i) to
total_revenue at each step.
10. After your loop, print the value of total_revenue, so the output looks like:
11. Find the average daily revenue by dividing total_revenue by 7. Call this
number average_daily_revenue and print it out.
12. Carly thinks she can bring in more customers by advertising all of the haircuts
she has that are under 30 dollars.
Use a list comprehension to create a list called cuts_under_30 that has the entry
hairstyles[i] for each i for which new_prices[i] is less than 30.