I need help with .insert in List Project

I need help with Checkpoint 12


Can you please share a link to the exercise along with specifically what you need help on?

Thanks so much for responding. The exercise is on line checkpoint 11 (line 32). I don’t seem to get to insert the list as it should.


Can you link to the original exercise/project page on Codecademy so we can see what it’s asking of you?

So, you’ve got pizza_and_prices which is a list of items, of which each item is also comprised of two items [the price, the variety].
Insert takes in the index followed by the item you want to insert.
So, you’ve got;
pizza_and_prices.insert(2, “peppers”)
which it’s taking as insert “peppers” at index 2.
The exercise is asking you to add the pizza [2.5, “peppers”] at the index so it keeps the list in order.
So, you’ve got to look through the last list you’ve printed and see where it should go to.


It wants to sit after those priced at 2. So it should end up at index 4 and move sausage and pineapple back one place.

So the line becomes
pizza_and_prices.insert( index, entry containing price and variety)


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

1 Like

wow…thanks so much for this detailed explanation and solution to my question. :100: :innocent:

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.