Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution #854

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Solution #854

wants to merge 7 commits into from

Conversation

Dmitriy1504
Copy link

No description provided.

Copy link

@Polyakiv-Andrey Polyakiv-Andrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests not passed!

app/main.py Outdated
Comment on lines 11 to 17
person_list = []
for person in people:
person1 = list(person.values())
name = person1[0]
age = person1[1]

person_list.append(Person(name, age))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to use list comprehension

app/main.py Outdated
Comment on lines 18 to 29
count = 0
for person1 in people:
if "wife" in person1:
for person2 in person_list:
if person2.name == person1["wife"]:
person_list[count].wife = person2

else:
for person2 in person_list:
if person2.name == person["husband"]:
person_list[count].husband = person2
count += 1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
count = 0
for person1 in people:
if "wife" in person1:
for person2 in person_list:
if person2.name == person1["wife"]:
person_list[count].wife = person2
else:
for person2 in person_list:
if person2.name == person["husband"]:
person_list[count].husband = person2
count += 1
for pl in people:
person = Person.people[pl["name"]]
if pl.get("wife"):
person.wife = Person.people[pl["wife"]]
if pl.get("husband"):
person.husband = Person.people[pl["husband"]]

@Dmitriy1504 Dmitriy1504 requested a review from vsmutok November 19, 2023 13:12
Copy link

@vsmutok vsmutok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Job 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants