Skip to content

Solution#2846

Open
KlimukM wants to merge 2 commits into
mate-academy:masterfrom
KlimukM:develop
Open

Solution#2846
KlimukM wants to merge 2 commits into
mate-academy:masterfrom
KlimukM:develop

Conversation

@KlimukM
Copy link
Copy Markdown

@KlimukM KlimukM commented May 25, 2026

No description provided.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Your code implements all functional requirements correctly and the logic works as expected. However, three explicit checklist items are violated and require correction: [CHECKLIST ITEM #2] Lines 18-27 use nested if statements that should be combined with and operators (e.g., if "wife" in person_dict and wife_name in Person.people:), [CHECKLIST ITEM #3] Lines 11-14 use a traditional for loop instead of list comprehension (e.g., person_list = [Person(p["name"], p["age"]) for p in people]), and [CHECKLIST ITEM #4] Lines 18-19 and 23-24 explicitly check key presence before accessing values instead of using dict.get() (e.g., if person_dict.get("wife"):). These are straightforward refactors that maintain your correct logic while meeting the style requirements.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread app/main.py Outdated
Comment on lines +18 to +21

if "wife" in person_dict and person_dict["wife"] is not None:
wife_name = person_dict["wife"]
if wife_name in Person.people:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #2: Use and to combine conditions instead of nesting if statements. Combine with and wife_name in Person.people.

Comment thread app/main.py Outdated
Comment on lines +11 to +14
person_list = []
for person_dict in people:
person_obj = Person(person_dict["name"], person_dict["age"])
person_list.append(person_obj)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #3: Use list comprehension instead of traditional for loop: person_list = [Person(p["name"], p["age"]) for p in people]

Comment thread app/main.py Outdated
Comment on lines +18 to +19

if "wife" in person_dict and person_dict["wife"] is not None:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #4: Use dict.get() method instead of explicitly checking for key presence. Consider: if person_dict.get("wife"):

Comment thread app/main.py Outdated
Comment on lines +23 to +26

if "husband" in person_dict and person_dict["husband"] is not None:
husband_name = person_dict["husband"]
if husband_name in Person.people:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #2: Use and to combine conditions instead of nesting if statements. Combine with and husband_name in Person.people.

Comment thread app/main.py Outdated
Comment on lines +23 to +24

if "husband" in person_dict and person_dict["husband"] is not None:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #4: Use dict.get() method instead of explicitly checking for key presence. Consider: if person_dict.get("husband"):

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Your solution is approved. All requirements have been successfully implemented: the Person class correctly populates the class attribute dictionary, create_person_list uses list comprehension as required, spouse relationships are properly linked using dict.get() for safe access, and AttributeError behavior is correctly handled for None spouses. The three checklist violations from the previous review have all been addressed—list comprehension on line 11, dict.get() on lines 16 and 20, and and operators on lines 17 and 21. Great work completing all requirements!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

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