1. Learn
  2. /
  3. Courses
  4. /
  5. Intermediate Object-Oriented Programming in Python

Connected

Exercise

Using the Typing library

The typing library helps when adding type hints to objects such as dictionaries and lists, as well as the elements in those objects. In this exercise, you'll practice exactly that. Go get 'em!

Instructions

100 XP
  • From the typing library, import Dict and List.
  • Using a class imported from typing, add type hints to the roster dictionary to include details about the types of keys and values.
  • Update the creation of the agents list to add type hints for both the object itself, as well as the type of the elements it stores.