Skip to content

Commit

Permalink
'Solution'
Browse files Browse the repository at this point in the history
  • Loading branch information
romanshupak committed Sep 13, 2023
1 parent e075ff6 commit cb6ff8c
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
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

def create_person_list(people: list[dict]) -> list:
list_instances = [
Person(person["name"], person["age"]) for person in people
]

for person in people:
if person.get("wife"):
person_name = person["name"]
wife_name = person["wife"]
Person.people[person_name].wife = Person.people.get(wife_name)
if person.get("husband"):
person_name = person["name"]
husband_name = person["husband"]
Person.people[person_name].husband = (
Person.people.get(husband_name)
)
return list_instances

0 comments on commit cb6ff8c

Please sign in to comment.