Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution #824

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 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
self.people[name] = self


def create_person_list(people: list) -> list:
# write your code here
pass
person_list = []
# add people to list
for dict_of_person in people:
new_person = Person(dict_of_person["name"], dict_of_person["age"])
person_list.append(new_person)
# add attributes to each person
class_list = Person.people
for person in people:
if "wife" in person and person["wife"] is not None:
class_list[person["name"]].wife = class_list[person["wife"]]
elif "husband" in person and person["husband"] is not None:
class_list[person["name"]].husband = class_list[person["husband"]]
return person_list
Loading