From 66919bfb04620d86456a6b92f23c86df1ae20766 Mon Sep 17 00:00:00 2001 From: Mazurkav Date: Tue, 10 Dec 2024 16:55:53 +0200 Subject: [PATCH] Solution --- app/main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/main.py b/app/main.py index e38c77b8..b0255198 100644 --- a/app/main.py +++ b/app/main.py @@ -1,8 +1,8 @@ class Person: # Class attribute to store Person instances by name - people = {} + people: dict[str, "Person"] = {} - def __init__(self, name: str, age: int): + def __init__(self, name: str, age: int) -> None: """ Initialize a Person instance. @@ -15,7 +15,7 @@ def __init__(self, name: str, age: int): Person.people[name] = self -def create_person_list(people: list) -> list: +def create_person_list(people: list[dict]) -> list[Person]: """ Create a list of Person instances from a list of dictionaries. @@ -24,8 +24,8 @@ def create_person_list(people: list) -> list: """ # First, create Person instances without relationships person_instances = [ - Person(person["name"], - person["age"]) for person in people + Person(person["name"], person["age"]) + for person in people ] # Then, set relationships (wife/husband)