**edit: Ok so in desperation I reset the code, typed it back in identically and now it works immediately, so puzzled
-> muralighosh, I am having the same problem and you say you solved it but not how
What did you do? My code is as below:
animals = [“aardvark”, “badger”, “duck”, “emu”, “fennec fox”]
duck_index = animals.index(“duck”) # Use index() to find “duck”
Your code here!
print animals # Observe what prints after the insert operation
but like you I am getting an error message : Oops, try again. It looks like “cobra” is not at the correct location (index 4).
My understanding is: If duck is at index 2 then I am inserting cobra in front of duck therefore cobra is at 2 and duck is now at 3. Where does index 4 come into it?
I can make it work by changing the position of duck in the original list, but surely that isn’t the idea?
Could someone put me straight please?