Skip to content

Commit

Permalink
'Solution'
Browse files Browse the repository at this point in the history
  • Loading branch information
yanamushka committed Oct 26, 2023
1 parent e075ff6 commit f6063f4
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,36 @@
class Person:
# write your code here
pass
people = {}

def __init__(self, name: str, age: int):
self.name = name
self.age = age
Person.people[name] = self


def create_person_list(people: list) -> list:
# write your code here
pass
person_list = []
for someone in people:
name = someone["name"]
age = someone["age"]
person = Person(name, age)
person_list.append(person)

for someone in people:
if "wife" in someone and someone["wife"] is not None:
wife_name = someone["wife"]
for i in person_list:
if wife_name == i.name:
for j in person_list:
if j.name == someone["name"]:
j.wife = i

for someone in people:
if "husband" in someone.keys() and someone["husband"] is not None:
husband_name = someone["husband"]
for i in person_list:
if husband_name == i.name:
for j in person_list:
if j.name == someone["name"]:
j.husband = i

return person_list

0 comments on commit f6063f4

Please sign in to comment.