Skip to content

Solution#2952

Open
aur1ka wants to merge 1 commit into
mate-academy:masterfrom
aur1ka:develop
Open

Solution#2952
aur1ka wants to merge 1 commit into
mate-academy:masterfrom
aur1ka:develop

Conversation

@aur1ka

@aur1ka aur1ka commented Jul 10, 2026

Copy link
Copy Markdown

No description provided.

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

Copy link
Copy Markdown

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 because it correctly implements all functional requirements: the Person class behaves as expected, Person.people is maintained properly, and create_person_list returns the right instances with the wife/husband relationships wired up correctly. The example relations like person_list[0].wife is person_list[2] and the expected AttributeError for missing spouse attributes will all work with your current logic.

The remaining issues are style-related checklist points rather than functional blockers. In app/main.py, when you build the result list (around the loop over people), you can simplify this by using a list comprehension as recommended, for example: result = [Person(p["name"], p["age"]) for p in people] [CHECKLIST ITEM #3]. Similarly, for spouse lookup, instead of if "wife" in person and person["wife"] is not None:, prefer wife_name = person.get("wife") followed by if wife_name is not None: (and likewise for husband) [CHECKLIST ITEM #4].

Functionally you are in good shape; treating these checklist items as a chance to practice more idiomatic Python will make your code cleaner and more in line with the course guidelines.


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

Footnotes

  1. Rate AI review example

Comment thread app/main.py
Comment on lines +14 to +17
result = []
for person in people:
temp = Person(person["name"], person["age"])
result.append(temp)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This violates checklist item #3: "When creating a list of instances from a collection (such as a list of dictionaries), it is recommended to use list comprehension rather than traditional for loops." You currently build result with a for loop; consider a comprehension like [Person(p["name"], p["age"]) for p in people].

Comment thread app/main.py
Comment on lines +21 to +24
if "wife" in person and person["wife"] is not None:
temp.wife = Person.people[person["wife"]]

if "husband" in person and person["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.

This violates checklist item #4: "When accessing values in a dictionary, it is better to use the dict.get() method instead of explicitly checking for the presence of a key." Your pattern if "wife" in person and person["wife"] is not None: matches the "Bad example" from the checklist. Use person.get("wife") and person.get("husband") instead.

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