PYTHON TUTORIALS

Data Structures Exercise Answer Key

Answer Key

  1. fruits = ["apple", "apple", "banana", "grape", "orange", "orange"]

    This is a LIST.
  2. fruits = fruits.remove("grape")
  3. manager = ("Robert", "Senior Software Engineering Manager", 42, "Columbus, OH")

    This is a TUPLE.
  4. manager.index(42)
  5. national_brands = {"Nike", "Vans", "Converse", "New Balance"}

    This is a SET.
  6. global_brands = {"Nike", "Vans", "Fila", "Ecco"}
    global_brands.intersection(local_brands)
  7. inventory = {"Small T-Shirts": 45, "Medium T-Shirts": 72, "Large T-Shirts": 55, "XL T-Shirts": 60}

    This is a DICTIONARY.
  8. inventory = inventory.pop("Small T-Shirts")