diff --git a/app/main.py b/app/main.py index f6bcaa1dd..7ee108c49 100644 --- a/app/main.py +++ b/app/main.py @@ -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"} +] +