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

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

Solution #807

wants to merge 5 commits into from

Conversation

TymurSh
Copy link

@TymurSh TymurSh commented Oct 16, 2023

No description provided.

app/main.py Outdated
Comment on lines 13 to 16
person_list = []

for dc in people:
_ = Person(dc["name"], dc["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 21
if "wife" in dc:
if dc["wife"] is not None:

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 dc:
if dc["wife"] is not None:
if dc.get("wife"):

app/main.py Outdated
Comment on lines 24 to 25
if "husband" in dc:
if dc["husband"] is not None:

Choose a reason for hiding this comment

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

Suggested change
if "husband" in dc:
if dc["husband"] is not None:
if dc.get("husband"):

@TymurSh TymurSh requested a review from EdAlekseiev October 19, 2023 22:00
app/main.py Outdated
Comment on lines 12 to 14
person_list = []

_ = [Person(dc["name"], dc["age"]) for dc in people]

Choose a reason for hiding this comment

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

Suggested change
person_list = []
_ = [Person(dc["name"], dc["age"]) for dc in people]
person_list = [Person(dc["name"], dc["age"]) for dc in people]

Copy link
Author

Choose a reason for hiding this comment

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

when i try this way in the end of test person_list has 2 copies for each Person

Choose a reason for hiding this comment

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

If you delete person_list.append(Person.people[dc["name"]]) in 25 line, you will not have duplicates in person_list

app/main.py Outdated
Comment on lines 27 to 28
for i in person_list:
print(i.name)

Choose a reason for hiding this comment

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

It is redundant code

@TymurSh TymurSh requested a review from EdAlekseiev October 23, 2023 11:52
app/main.py Outdated
Comment on lines 12 to 14
person_list = []

_ = [Person(dc["name"], dc["age"]) for dc in people]

Choose a reason for hiding this comment

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

If you delete person_list.append(Person.people[dc["name"]]) in 25 line, you will not have duplicates in person_list

@TymurSh TymurSh requested a review from EdAlekseiev October 23, 2023 15:11
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

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