Type hinting cu clase personalizate
În acest exercițiu, vei folosi cuvintele cheie built-in pentru tipuri, biblioteca typing și propria ta clasă personalizată pentru a exersa type hinting. List a fost importat din biblioteca typing. Să începem!
Acest exercițiu face parte din cursul
Programare orientată pe obiecte intermediară în Python
Exercițiu interactiv practic
Încearcă acest exercițiu completând acest cod de exemplu.
# Define an agent class with a constructor, add type hints
class Agent:
def __init__(self, ____: ____, ____: ____):
self.____: ____ = codename
self.____: int = ____