A list index behaves like any other variable name! It can be used to access as well as assign values.

You saw how to access a list index like this:

zoo_animals[0] # Gets the value "pangolin"

You can see how assignment works on line 5:

zoo_animals[2] = "hyena" # Changes "sloth" to "hyena"



Write an assignment statement that will replace the item that currently holds the value "tiger" with another animal (as a string). It can be any animal you like.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?