In the Carly’s Clippers objective, I don’t understand why I’m getting an error in the second last line:
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
for price in prices:
total_price += price
average_price = total_price / len(prices)
print("Average Haircut Price: " + str(average_price))
new_prices = [prices - 5 for price in prices]
print(new_prices)
The line in bold above, matches exactly to the code used in the YouTube video so I’m confused. Here is the error message:
Traceback (most recent call last):
File “script.py”, line 16, in
new_prices = [prices - 5 for price in prices]
File “script.py”, line 16, in
new_prices = [prices - 5 for price in prices]
TypeError: unsupported operand type(s) for -: ‘list’ and ‘int’
Thanks!