Skip to content

Commit

Permalink
Update main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniaK123 authored Dec 14, 2024
1 parent 0dbf9a9 commit 953fa91
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 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
self.people[name] = self


def create_person_list(people: list) -> list:
# write your code here
pass
for human in people:
Person(human["name"], human["age"])

for human in people:
if human.get("wife"):
Person.people[human["name"]].wife = Person.people[human["wife"]]
if human.get("husband"):
Person.people[human["name"]].husband \
= Person.people[human["husband"]]

return list(Person.people.values())

0 comments on commit 953fa91

Please sign in to comment.