-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
implement py-person-class #1667
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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. While there are some potential areas for improvement, such as ensuring the existence of keys in dictionaries to prevent KeyError
, these are minor and do not impact the overall functionality. 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! ✨
result_list = [Person(name=person["name"], age=person["age"]) | ||
for person in people] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The list comprehension correctly creates Person
instances, but ensure that the input list people
contains dictionaries with the keys name
and age
to avoid KeyError.
main_person = Person.people[person["name"]] | ||
wife_person = Person.people[person["wife"]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before accessing Person.people[person['wife']]
, ensure that the wife exists in the people
dictionary to avoid a potential KeyError.
main_person = Person.people[person["name"]] | ||
husband_person = Person.people[person["husband"]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, before accessing Person.people[person['husband']]
, ensure that the husband exists in the people
dictionary to avoid a potential KeyError.
No description provided.