I'm not sure what I'm doing


On line 9 you list out a sequence of comma separated lists, but do not give them a container. Python will by default assign the sequence to tuple, which as we know is immutable, so therefore not sortable. Give your sequence a parent container by adding before and after square brackets.

1 Like

Could you please write it for me so i can see?

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

That’s a valid sequence which Python sees as a tuple.

Check the type of the pizza_and_prices object and you’ll see what I mean. It’s a tuple.

Solution would be to insert a square bracket at the beginning and end of that, then it will no longer be ‘assumed to be a tuple’ but will be ‘defined as a list’.