Maintaining Order [can some one help]


animals = ["aardvark", "badger", "duck", "emu", "fennec fox"]
duck_index = animals.index("duckUse index() to find "duck"
animals.insert(duck_index,"cobra")# Your code here!
print animals # Observe what prints after the insert operation


this line:

duck_index = animals.index("duckUse index() to find "duck"

the first bit is code:

duck_index = animals.index("duck

then after it there are instructions:

Use index() to find "duck"

remove the instructions and finish the code.


I did the same mistake, English is not my prime language so maybe that why.

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

animals.insert(duck_index, "cobra") Try this.


by jakhal:stuck_out_tongue:


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