Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
EvgeniyChernyakIT committed Dec 11, 2024
1 parent 0dbf9a9 commit 8e48081
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
class Person:
# write your code here
pass

people = {}

def create_person_list(people: list) -> list:
# write your code here
pass
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[dict[str]]) -> list:
new_person_list = [Person(person.get("name"),
person.get("age")) for person in people_list]

for person in people_list:
if person.get("wife"):
wife = Person.people[person.get("wife")]
Person.people[person.get("name")].wife = wife

if person.get("husband"):
husband = Person.people[person.get("husband")]
Person.people[person.get("name")].husband = husband

return new_person_list

0 comments on commit 8e48081

Please sign in to comment.