Skip to content

Commit

Permalink
Corrections 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlad1slavo committed Nov 22, 2023
1 parent 91208c0 commit 4467bbd
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,13 @@ def __init__(self, name: str, age: int) -> None:
self.name = name
self.age = age
Person.people[name] = self
pass


def create_person_list(people: list) -> list[Person]:
Person.people = {}
for person in people:
Person(person["name"], person["age"])
for person in people:
current_person = Person.people[person["name"]]
if person.get("wife") is not None:
current_person.wife = Person.people[person["wife"]]
elif person.get("husband") is not None:
current_person.husband = Person.people[person["husband"]]

return list(Person.people.values())

pass
person_list = [Person(pers["name"], pers["age"]) for pers in people]
for pers, person in zip(people, person_list):
if "wife" in pers and pers["wife"]:
person.wife = Person.people[pers["wife"]]
elif "husband" in pers and pers["husband"]:
person.husband = Person.people[pers["husband"]]
return person_list

0 comments on commit 4467bbd

Please sign in to comment.