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

Closed
wants to merge 2 commits into from
Closed

Solution #853

wants to merge 2 commits into from

Conversation

RangerLeoo
Copy link

No description provided.

app/main.py Outdated
Comment on lines 14 to 17
person_list = []

for index, person in enumerate(people):
person_list.append(Person(name=person["name"], age=person["age"]))

Choose a reason for hiding this comment

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

Use list comprehension here

app/main.py Outdated
Comment on lines 20 to 23
if "wife" in person and person["wife"] is not None:
person_list[index].wife = Person.people[person["wife"]]
elif "husband" in person and person["husband"] is not None:
person_list[index].husband = Person.people[person["husband"]]

Choose a reason for hiding this comment

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

Suggested change
if "wife" in person and person["wife"] is not None:
person_list[index].wife = Person.people[person["wife"]]
elif "husband" in person and person["husband"] is not None:
person_list[index].husband = Person.people[person["husband"]]
if person.get("wife"):
person_list[index].wife = Person.people[person["wife"]]
elif person.get("husband"):
person_list[index].husband = Person.people[person["husband"]]

Copy link

@EdAlekseiev EdAlekseiev 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

@RangerLeoo RangerLeoo closed this by deleting the head repository Dec 10, 2024
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.

2 participants