I have encountered the same problem. I even got frustrated and watched the youtube tutorial. Her code returns 3 while mine returns 0, but our codes are identical.
the hint for this step: You can use .count
to find the number of occurrences of a value in a list:
my_list = ["a", "a", "b"] number_of_as = my_list.count("a")# number_of_as is 2
the tutorial: Lens Slice - YouTube
my code:
toppings = ['pepperoni', 'pineapple', 'cheese', 'sausage', 'olives', 'anchovies', 'mushrooms']
prices = [2, 6, 1, 3, 2, 7, 2]
num_pizzas = len(toppings)
print("We sell " + str(num_pizzas) + " different kinds of pizza!")
pizzas = list(zip(prices, toppings))
print(pizzas)
pizzas.sort()
cheapest_pizza = pizzas[0]
priciest_pizza = pizzas[-1]
three_cheapest = pizzas[0:3]
print(three_cheapest)
num_two_dollar_slices = pizzas.count(2)
print(num_two_dollar_slices)
I have actually done this assignment before the course was updated (and I restarted it instead of just doing the new material…like a fool) and I don’t recall having this problem then. Maybe the original material was incorrect (due to the tuples explanation) and was corrected, but the hint and tutorial were accidentally overlooked. I am just speculating. I am a beginner but you can see that the hint directs us to write it this way and so does the walkthrough. Good luck! 