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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Solution #1651

wants to merge 1 commit into from

Conversation

olyamalysh
Copy link

No description provided.

Copy link

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


Thank you for your hard work on this Pull Request! 😊 While your code meets most of the task requirements, there are a few critical issues that need to be addressed before we can approve it:

  1. Use of dict.get() Method: It's important to use dict.get() when accessing dictionary values to prevent potential KeyError exceptions. This will make your code more robust and easier to read.

  2. Handling None Assignments: When assigning person.wife or person.husband, ensure that these entries exist in the Person.people dictionary. Assigning None could lead to issues if not properly handled.

  3. Unique Names in people Dictionary: Make sure that the names used as keys in the people dictionary are unique to prevent overwriting existing Person instances.

These changes are crucial for ensuring the functionality and reliability of your code. Once you've addressed these points, feel free to resubmit your Pull Request. Keep up the great work, and I'm looking forward to seeing your improvements! 🚀

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

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

@@ -1,8 +1,28 @@
class Person:
# write your code here
people = {}

Choose a reason for hiding this comment

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

The people dictionary is used to store Person instances by their name. Ensure that names are unique to avoid overwriting existing entries.

person = Person(person_data["name"], person_data["age"])

if "wife" in person_data and person_data["wife"]:
person.wife = Person.people.get(person_data["wife"])

Choose a reason for hiding this comment

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

When assigning person.wife, ensure that the wife exists in the Person.people dictionary. If not, this will result in None, which could lead to issues if not handled properly.

person.wife.husband = person

if "husband" in person_data and person_data["husband"]:
person.husband = Person.people.get(person_data["husband"])

Choose a reason for hiding this comment

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

Similarly, when assigning person.husband, ensure that the husband exists in the Person.people dictionary to avoid potential None assignments.

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