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 79a96fa
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
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

def create_person_list(people: list) -> None:
person_list = []
for person in people:
person_instance = Person(name=person["name"], age=person["age"])
person_list.append(person_instance)

for person in people:
person_instance = Person.people[person["name"]]
if "wife" in person and person["wife"] is not None:
person_instance.wife = Person.people[person["wife"]]
elif "husband" in person and person["husband"] is not None:
person_instance.husband = Person.people[person["husband"]]

return person_list

0 comments on commit 79a96fa

Please sign in to comment.