How do I change the value of tiger?

Question

How do I change the value of tiger?

Answer

The first step is to note what index ”tiger” is currently at, and remember that indexes start from 0.
Then we use our list name, brackets, and that index number, followed by an equal sign and the new value you want to be stored in that index.
list_name[index_of_tiger] = “new value!”

Or you can simply change the string where it says "tiger" and change it with whatever animal you want (in that case I choose bear :love_you_gesture:)

1 Like

zoo_animals[3] = “bear”

1 Like

why cant it be ==, so for example zoo_animals[3] == “Bear”

That’s a different operator, == is a comparison operator used for checking equivalence and returns either True or False. For example-

print("red" == "blue")
Out: False

print(9 == 3*3)
Out: True

It does not perform any assignment regardless of the boolean value returned.

1 Like