Skip to content

Commit

Permalink
'solution'
Browse files Browse the repository at this point in the history
  • Loading branch information
xborismenx committed Oct 25, 2023
1 parent e075ff6 commit b565bb4
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
class Person:
# write your code here
pass

people = {}

def __init__(self, name: str, age: int) -> None:
self.name = name
self.age = age
self.people[name] = self


def create_person_list(people: list) -> list:
# write your code here
pass

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

return people_list

people = [
{"name": "Ross", "age": 30, "wife": "Rachel"},
{"name": "Joey", "age": 29, "wife": None},
{"name": "Rachel", "age": 28, "husband": "Ross"}
]

0 comments on commit b565bb4

Please sign in to comment.