Skip to Content
Learn
Python Lists and Dictionaries
New Neighbors

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"

Instructions

1.

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.

Folder Icon

Take this course for free

Already have an account?