Maintaining Order bug


#1

In the section titled Maintaining Order, I have this code:

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

# Your code here!
duck_index=animals.index("duck")
print(duck_index)
animals.insert(2,'cobra')

print animals # Observe what prints after the insert operation

The error says:
Oops, try again. Did you forget to assign a value to duck_index?
Please help. Thanks!:grin::grin:


#2

Instead of animals.insert(2, "cobra")

try animals.insert(duck_index, "cobra")


#3

you didnt put the index on line 2.
put duck_index(2)


#4

@methodwhiz88234

Not working and by the way the error says I didn't assign a value to duck_index


#5

@microace02640
Your idea, worked though.