Hello @mtf ,

Thank you so much for this information. I really appreciate it.

So basically the range function creates or generates a range of numbers and len() allows us to access an index in that range?

Sorry if I am struggling to understand. I think I am on the right track but will wait for your response.

Thank you again for your time.

P.S. With the code below specifically the line that is written as such: total_revenue += prices[i] * last_week[i]

Why couldn’t i write the cuts_under_30 = [hairstyles[i] for i in range(len(new_prices)) if new_prices[i] < 30] like the following: cuts_30 = [hairsytles[i] for i in new_prices[i] if new_prices[i] < 30]

Since new_prices is already a list and there is no need to create a range using the range()? Sorry if I am misunderstanding this.

hairstyles = [“bouffant”, “pixie”, “dreadlocks”, “crew”, “bowl”, “bob”, “mohawk”, “flattop”]

prices = [30, 25, 40, 20, 20, 35, 50, 35]

last_week = [2, 3, 5, 8, 4, 4, 6, 2]

total_price = 0

#created a loop to sum up the total of all our prices for our cuts

for price in prices:

total_price += price

#created a variable to get the average price of our cuts

average_price = total_price/len(prices)

#printing out the average price of our cuts

print(“The average price of our cuts are:”, average_price, “\n”)

#prices were too expensive. Created a for loop to cut the price of each haircut but $5 using a compreshive list

new_prices = [price - 5 for price in prices]

print(“The new price for each of our cuts are:\n”, new_prices, “\n”)

#finding out the total revenue of our income from last week

total_revenue = 0

for i in range(8):

total_revenue += prices[i] * last_week[i]

print(“Total Revenue is:”, total_revenue, “\n”)

#Finding out our daily average of our total_revenu

average_daily_revenue = total_revenue / 7

print(“Your average daily revenue is:”, average_daily_revenue, “\n”)

#list comprehension to advertise haircuts that are under 30 dollars

cuts_under_30 = [hairstyles[i] for i in range(len(new_prices)) if new_prices[i] < 30]

print(“Here are the cuts that are under $30 dollars:”, cuts_under_30)