Carly's Clippers

In the Carly’s Clippers objective, I don’t understand why I’m getting an error in the second last line:

https://www.codecademy.com/paths/computer-science/tracks/cspath-flow-data-iteration/modules/dspath-python-loops/projects/carlys-clippers

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!

1 Like

Never mind, found a small type “prices” instead of “price”

1 Like

You want decrease the exact values, in the list one by one !