Maintaining Order (solved)


#1

I am having trouble getting through this one and i dont know what im doing wrong..

animals = ["aardvark", "badger", "duck", "emu", "fennec fox"]
duck_index = animals.index("duck")# Use index() to find "duck"
 
animals.insert(2, "cobra")
# Your code here!



print animals # Observe what prints after the insert operation

The error is as follows
Oops, try again. Make sure to pass duck_index as the first argument in insert()


#4

Can you provide a link to the exercise?


#5

ive solved my problem. thank you though


#6

You're welcome, although I did nothing. :slight_smile:


#8

Hello.How ur solved problem?


#9

Use this code :)!

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

animals.insert(duck_index, "cobra")


#10

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