1. Learn
  2. /
  3. Courses
  4. /
  5. Writing Efficient Python Code

Exercise

Combining Pokémon names and types

Three lists have been loaded into your session from a dataset that contains 720 Pokémon:

  • The names list contains the names of each Pokémon.
  • The primary_types list contains the corresponding primary type of each Pokémon.
  • The secondary_types list contains the corresponding secondary type of each Pokémon (nan if the Pokémon has only one type).

We want to combine each Pokémon's name and types together so that you easily see a description of each Pokémon. Practice using zip() to accomplish this task.

Instructions 1/3

undefined XP
  • 1

    Combine the names list and the primary_types list into a new list object (called names_type1).

  • 2

    Combine names, primary_types, and secondary_types (in that order) using zip() and unpack the zip object into a new list.

  • 3

    Use zip() to combine the first five items from the names list and the first three items from the primary_types list.