Skip to content

Commit

Permalink
'Solution2'
Browse files Browse the repository at this point in the history
  • Loading branch information
nagafochfv committed Dec 11, 2024
1 parent 9aeb161 commit c1ddde0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ def create_person_list(peoples: list) -> list:
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"]))
wife = Person.people.get(pers["wife"])
if wife:
setattr(person, "wife", wife)
else:
setattr(person, "wife", None)
if "husband" in pers and pers["husband"] is not None:
setattr(person, "husband", Person.people.get(pers["husband"]))
husband = Person.people.get(pers["husband"])
if husband:
setattr(person, "husband", husband)
else:
setattr(person, "husband", None)
return person_list

0 comments on commit c1ddde0

Please sign in to comment.