Whats wrong with my .sort()?
My Code;
toppings = [“pepperoni”, “pineapple”, “cheese”, “sausage”, “olives”, “anchovies”, “mushrooms”]
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(toppings) + " 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() <<<<<< error
cheapest_pizza = pizza_and_prices[0]
priciest_pizza = pizza_and_prices [-1]
pizza_and_prices.pop()
pizza_and_prices.insert[2.5, “peppers”]
three_cheapest = pizza_and_prices[:2]
print(three_cheapest)
Prints out this error:
Traceback (most recent call last):
File “script.py”, line 10, in
pizza_and_prices.sort()
TypeError: ‘<’ not supported between instances of ‘str’ and ‘int’