Skip to content

Commit

Permalink
'Solution'
Browse files Browse the repository at this point in the history
  • Loading branch information
nagafochfv committed Dec 10, 2024
1 parent 0dbf9a9 commit 9aeb161
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
class Person:
# write your code here
pass
people = {}

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

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

def create_person_list(peoples: list) -> list:
person_list = []
for pers in peoples:
person = Person(pers["name"], pers["age"])
person_list.append(person)
for pers in peoples:
person = Person.people[pers["name"]]
if "wife" in pers and pers["wife"] is not None:
setattr(person, "wife", Person.people.get(pers["wife"]))
if "husband" in pers and pers["husband"] is not None:
setattr(person, "husband", Person.people.get(pers["husband"]))
return person_list

0 comments on commit 9aeb161

Please sign in to comment.