Get startedGet started for free

Type hinting with custom classes

In this exercise, you'll use type keywords, generic syntax, and your own custom class to practice type hinting. Time to get started!

This exercise is part of the course

Intermediate Object-Oriented Programming in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Define an agent class with a constructor, add type hints
class Agent:
  def __init__(self, ____: ____, ____: ____):
    self.____: ____ = codename
    self.____: int  = ____
Edit and Run Code