Mayday 7-14


#1

animals = ["aardvark", "badger", "duck", "emu", "fennec fox"]
duck_index=animals.index("duck")
print duck_index
animals.insert(2,"cobra")

print animals
here comes error,what does that mean?: Make sure to pass duck_index as the first argument in insert()


#2

Hi @javaace19518 ,

Codecademy had you use animals.index("duck") to find the index of "duck" within the animals list, and then assign it to duck_index. The intent is to have you then use duck_index to access the animals list for performing the insertion, as follows ...

animals.insert(duck_index, "cobra")

#3

GAH. I had a functioning piece of code that accomplished the same goal differently. Sometimes the semantics can be a pain. But I can see what the point of this is. Creating specific variables to call lines from indices.