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

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

Solution #1666

wants to merge 1 commit into from

Conversation

Vl-Misha
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.

Great job on implementing the Person class and the create_person_list function! 🎉 While there are a few minor improvements suggested, such as using dict.get() for safer dictionary access and adopting list comprehension for a more concise code, these do not impact the core functionality of your solution. Keep up the good work and consider these suggestions for future enhancements! 😊

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

Comment on lines +12 to +14
for person_dict in people:
person = Person(name=person_dict["name"], age=person_dict["age"])
person_instances.append(person)

Choose a reason for hiding this comment

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

Consider using list comprehension to create person_instances from people, as recommended in the checklist. This will make the code more concise and Pythonic.


for person_dict in people:
person = Person.people[person_dict["name"]]
if "wife" in person_dict and person_dict["wife"]:

Choose a reason for hiding this comment

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

Use person_dict.get('wife') instead of checking for the key explicitly. This approach simplifies the code and avoids potential KeyError exceptions, making it cleaner and more concise as per the checklist.

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

Choose a reason for hiding this comment

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

Use person_dict.get('husband') instead of checking for the key explicitly. This approach simplifies the code and avoids potential KeyError exceptions, making it cleaner and more concise as per the checklist.

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