Maintaining Order


#1



https://www.codecademy.com/en/courses/python-beginner-en-pwmb1/1/4?curriculum_id=4f89dab3d788890003000096#


Make sure to pass duck_index as the first argument in insert().


animals = ["aardvark", "badger", "duck", "emu", "fennec fox"]
duck_index = animals.index("duck")   # Use index() to find "duck"

# Your code here!
animals.insert(2, "cobra")


print animals # Observe what prints after the insert operation


#2

here:

animals.insert(2, "cobra")

use duck_index, not a fixed number. This way, your code is more flexible


#3

Yes it works now, thank you


#4
  1. Use the .index(item) function to find the index of "duck". Assign that result to a variable called duck_index.
  2. Then .insert(index, item) the string "cobra" at that index.

I can do it. However, the instruction does not request that anything is passed as the first index


#5