7/14 Help needed


#1

Here is my code:

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

def index(duck_index)
duck_index = animals.index("duck")
print duck_index
animals.insert(2, "cobra")

print animals

It comes up with:
Oops, try again. Did you forget to assign a value to duck_index?

Could someone tell me whats wrong?


#2

Hello, @j4m3sh!
The problem with your code is that instead of using the value in duck_index, you're using the number 2 on

animals.insert(2, 'cobra')


It should be:

animals.insert(duck_index, 'cobra')

Quote me if there's anything else I can help you with!

Best regards,
g4be