Maintaining Order


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



animals.insert(2, "cobra")

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


Yes it works now, thank you

  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