Skip to content

Commit

Permalink
updated with list comprehension and method get()
Browse files Browse the repository at this point in the history
  • Loading branch information
Professor-Douel committed Dec 4, 2024
1 parent 1dbd313 commit 60a0344
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ def create_person_list(people: list) -> list:
name = person["name"]
instance = Person.people[name]

if "wife" in person and person["wife"]:
if person.get("wife"):
instance.wife = instance.people[person["wife"]]
elif "husband" in person and person["husband"]:
elif person.get("husband"):
instance.husband = instance.people[person["husband"]]

return person_list

0 comments on commit 60a0344

Please sign in to comment.