Is this code is correct for len slice

Your code below:

toppings=[“pepperoni”,“pineapple”,“cheese”,“sausage”,“olives”,“anchovies”,“mushroom”]

prices=[2,6,1,3,2,7,2]

num_two_dollar_slices=prices.count(2)

print(num_two_dollar_slices)

num_pizzas=len(toppings)

print(“We sell” + str(num_pizzas) + “different kinds of pizza!”)

pizza_and_prices=[[2,“pepperoni”],[6,“pineapple”],[1,“cheese”],[3,“sausage”],[2,“olives”],[7,“anchovies”],[2,“mushrooms”]]

print(pizza_and_prices)

pizza_and_prices.sort()

cheapest_pizza=pizza_and_prices[0][1]

pizza_and_prices.pop(-1)

pizza_and_prices.insert(4, [2.5, “peppers”])

three_cheapest=pizza_and_prices[2:]

print(three_cheapest)

Does it produce the intended results? Do you get any errors? Or, do you have a more specific question about the project?

1 Like

not get errors, but im confused as I write the correct code.

What part confuses you?

Please check the post “How to ask good questions (and get good answers).”