Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex committed Sep 11, 2023
1 parent e075ff6 commit fc2fa6f
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit fc2fa6f

Please sign in to comment.