Aan de slagGa gratis aan de slag

Type hinting with custom classes

In this exercise, you'll use built-in type keywords, the typing library, and your own custom class to practice type hinting. List has been imported from the typing library. Time to get started!

Deze oefening maakt deel uit van de cursus

Intermediate Object-Oriented Programming in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

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