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 #855

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

Solution #855

wants to merge 6 commits into from

Conversation

sofia653
Copy link

No description provided.

app/main.py Outdated
elif "husband" in person and person["husband"] is not None:
Person.people[person["name"]].husband = Person.people[person["husband"]]

return list(Person.people.values())

Choose a reason for hiding this comment

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

But if we two times run this function we should expect only people from people_list

app/main.py Outdated
Person(person["name"], person["age"])

for person in people_list:
if "wife" in person and person["wife"] is not None:

Choose a reason for hiding this comment

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

use .get instead of 2 conditions

app/main.py Outdated
pass

def create_person_list(people_list: list) -> list:
Person.people.clear()
Copy link

Choose a reason for hiding this comment

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

redundant here

app/main.py Outdated
Comment on lines 12 to 13
for person in people_list:
Person(person["name"], person["age"])
Copy link

Choose a reason for hiding this comment

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

people = [Person (person["name"], person["age"]) for person in people_list]

app/main.py Outdated
else:
person_instance.husband = Person.people[spouse_name]

return list(Person.people.values())
Copy link

Choose a reason for hiding this comment

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

Suggested change
return list(Person.people.values())
return people

@sofia653 sofia653 requested a review from vsmutok February 8, 2024 09:39
app/main.py Outdated Show resolved Hide resolved
Co-authored-by: ArsenPidhoretskyi <[email protected]>
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.

4 participants