Hi Everyone,
I am having an issue resolving the following error message directed at my code:
File “script.py”, line 28
cuts_under_30 = [hairstyles[i] for i in range(len(hairstyles)) if new_prices[i] < 30]
^
SyntaxError: invalid syntax
My code is as follows
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_prices = 0
for price in prices:
total_prices += price
print(total_prices)
average_price = total_prices / len(prices)
print("Average Haircut Price: $" + str(average_price))
new_prices = [price - 5 for price in prices]
print(new_prices)
total_revenue = 0
for i in range(len(hairstyles)):
total_revenue += (prices[i] * last_week[i])
print("Total Revenue: $" + str(total_revenue))
average_daily_revenue = total_revenue / 7
print("Average Daily Revenue: $" + str(average_daily_revenue)
cuts_under_30 = [hairstyles[i] for i in range(len(hairstyles)) if new_prices[i] < 30]
I know it’s probably a simple error that I’m overlooking, but I can’t seem to spot what the issue is here. Extra sets of eyes are appreciated!