From fc2fa6f46a70e7dd614c0b6045997ac7fc314018 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 11 Sep 2023 20:52:56 +0300 Subject: [PATCH] Solution --- app/main.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/main.py b/app/main.py index f6bcaa1dd..50b76313d 100644 --- a/app/main.py +++ b/app/main.py @@ -1,8 +1,18 @@ class Person: - # write your code here - pass + people = {} + + def __init__(self, name: str, age: int) -> None: + self.name = name + self.age = age + Person.people[name] = self def create_person_list(people: list) -> list: - # write your code here - pass + person_list = [Person(person["name"], person["age"]) for person in people] + for person in people: + if person.get("wife"): + Person.people[person["name"]].wife = Person.people[person["wife"]] + elif person.get("husband"): + Person.people[person["name"]].husband = Person.people[person["husband"]] + + return person_list