Skip to content

Commit

Permalink
first solution. all tests passed. flake8 app passed
Browse files Browse the repository at this point in the history
  • Loading branch information
Mykola-Osolinskyi committed Dec 4, 2024
1 parent 0dbf9a9 commit 443bad1
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 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 __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
persons = []

for person_inf in people:
person = Person(person_inf["name"], person_inf["age"])
persons.append(person)

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

return persons

0 comments on commit 443bad1

Please sign in to comment.