Skip to content

Commit

Permalink
Fixed mentor comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Dikey945 committed Oct 23, 2023
1 parent 1ae0921 commit 70f4cc8
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,21 @@ def __init__(self, name: str, age: int) -> None:


def create_person_list(people: list) -> list:
for person in people:
if person["name"] not in Person.people:
Person(person["name"], person["age"])
person_list = [
Person.people[person["name"]]
if person["name"] in Person.people
else Person(person["name"], person["age"])
for person in people
]

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

return list(Person.people.values())
return person_list

0 comments on commit 70f4cc8

Please sign in to comment.