/tuples

NSS Python3 exercise

Primary LanguagePython

NSS Exercise: Tuples

Description:

Work with tuples in Python

Instructions

  1. Create a tuple named zoo that contains your favorite animals.

  2. Find one of your animals using the .index(value) method on the tuple.

  3. Determine if an animal is in your tuple by using for value in tuple.

  4. Create a variable for each of the animals in your tuple with this cool feature of Python.

    # example
    (lizard, fox, mammoth) = zoo
    print(lizard)
    
  5. Convert your tuple into a list.

  6. Use extend() to add three more animals to your zoo.

  7. Convert the list back into a tuple.

How to run in terminal (Python3 used):

git clone https://github.com/Megraohoh/tuples
cd tuples
python zoo.py

Contributors:

Meghan Debity