I’m having trouble getting the syntax right on the .pop function I keep playing with placement and bracketing thinking I’m just doing something wrong but to no avail so this is my first post in the forums. So below is the relavent chunk. In my first thought. “.pop” would just grab the first (and only) “anchovies” it finds, starting from the end. no dice. below the main chunk of code are a few interations i tried attempting to the the syntax to push through
# Checkpoint 6
pizza_and_prices = [[2, "pepperoni"], [6, "pineapple"], [1, "cheese"], [3, "sausage"], [3, "olives"], [7, "anchovies"], [2, "mushrooms"]]
# Checkpoint 7
#print(pizza_and_prices)
# Checkpoint 8
pizza_and_prices.sort()
print(pizza_and_prices)
# Checkpoint 9
cheapest_pizza = pizza_and_prices[0]
print(cheapest_pizza)
# Checkpoint 10
priciest_pizza = pizza_and_prices[-1]
print(priciest_pizza)
# Checkpoint 11
pizza_and_prices.pop("anchovies")
pizza_and_prices.pop(-1)
pizza_and_prices[-1].pop(-1)
pizza_and_prices[-1].pop("anchovies")
Several others too. With no “anchovies” involved in the line it at least doesnt error code but it also doesnt nix the anchovies from the list. I’m sure this is something quite simple and just messing up. TIA
-Chris