Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Mazurkav committed Dec 10, 2024
1 parent 926bc9e commit 66919bf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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.
Expand All @@ -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)
Expand Down

0 comments on commit 66919bf

Please sign in to comment.