Quick question. In the exercise len’s slice there is a task
Your boss wants you to do some research on $2 slices.
Count the number of occurrences of
priceslist, and store the result in a variable called
num_two_dollar_slices. Print it out.
Everything goes well and I get the answered required ,my question is, why does count not return any value for list pizzas?
toppings = ['pepperoni','pineapple','cheese','sausage','olives','anchovies','mushrooms'] num_pizzas=len(toppings) prices = [2,6,1,3,2,7,2] pizzas = list(zip(prices,toppings)) pizzas.sort() num_two_dollar_slices=prices.count(2) cheapest_pizza = pizzas priciest_pizza = pizzas[-1] three_cheapest = pizzas[:3] print("We sell" ,num_two_dollar_slices , "different kinds of pizza!")