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' #1661

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

'Solution' #1661

wants to merge 1 commit into from

Conversation

Komar88lvl
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! 🎉 Your code meets the task requirements and constraints effectively. There are just a couple of minor improvements you could consider for future projects: using list comprehension for creating persons_list and accessing the people dictionary with Person.people instead of self.people. These changes will enhance the code's efficiency and correctness. Keep up the great work! 😊

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

def __init__(self, name: str, age: int) -> None:
self.name = name
self.age = age
self.people.update({self.name: self})

Choose a reason for hiding this comment

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

In the __init__ method, the people dictionary should be accessed using Person.people instead of self.people. This ensures that the class attribute is updated correctly. Change self.people.update({self.name: self}) to Person.people.update({self.name: self}).

Comment on lines +11 to +13
persons_list = []
for person in people:
persons_list.append(Person(person["name"], person["age"]))

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 persons_list as recommended in the checklist. This will make the code more concise and efficient. For example: persons_list = [Person(person['name'], person['age']) for person in people].

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