Work with tuples in Python
-
Create a tuple named
zoo
that contains your favorite animals. -
Find one of your animals using the
.index(value)
method on the tuple. -
Determine if an animal is in your tuple by using
for value in tuple
. -
Create a variable for each of the animals in your tuple with this cool feature of Python.
# example (lizard, fox, mammoth) = zoo print(lizard)
-
Convert your tuple into a list.
-
Use
extend()
to add three more animals to your zoo. -
Convert the list back into a tuple.
git clone https://github.com/Megraohoh/tuples
cd tuples
python zoo.py