Sorting

i want to sort the list(pizzas) in terms of prices not in terms of topping . when i use the code given below, it sorts the pizzas in terms of topping in alphabetic order.
the code is given below:

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(toppings, prices))
print(pizzas)
pizzas.sort()
print(pizzas)
cheapest_pizza = pizzas[0]
priciest_pizza = pizzas[-1]
three_cheapest = pizzas[:3]
print(three_cheapest)
num_two_dollar_slices = prices.count(2)
print(num_two_dollar_slices)

.sort() can take a key argument, which is used to indicate which key (in this case price) should be used for sorting

https://wiki.python.org/moin/HowTo/Sorting

I just looked at the instructions for https://www.codecademy.com/courses/learn-python-3/projects/lens-slice which I believe is the project you are working on. The instructions ask you to zip the lists together with prices first: pizzas = list(zip(prices, toppings)) This would solve your problem because by default the .sort() method sorts a list of tuples by the first element in each tuple. If you’d rather keep your list of pizzas as is you can do this:
pizzas.sort(key = lambda e: e[1])
This will sort the list by the second element of each tuple.