-
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
Solution #1590
base: master
Are you sure you want to change the base?
Solution #1590
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 create_person_list
function! 🎉 Your code meets the task requirements and constraints effectively. While there are minor style recommendations, such as using dict.get()
for safer dictionary access and list comprehensions for cleaner code, these do not impact the functionality. Keep up the good work and consider these suggestions for future improvements! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
app/main.py
Outdated
|
||
person_list = [] | ||
|
||
for person_data 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.
Consider using list comprehension for creating the person_list
to make the code more concise, as recommended in the checklist.
app/main.py
Outdated
|
||
for person_data in people: | ||
person = Person.people[person_data["name"]] | ||
if "wife" in person_data and person_data["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.
Use person_data.get('wife')
instead of checking with in
to simplify the code and avoid potential KeyError
exceptions, as suggested in the checklist.
app/main.py
Outdated
person = Person.people[person_data["name"]] | ||
if "wife" in person_data and person_data["wife"]: | ||
person.wife = Person.people[person_data["wife"]] | ||
elif "husband" in person_data and person_data["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.
Use person_data.get('husband')
instead of checking with in
to simplify the code and avoid potential KeyError
exceptions, as suggested in the checklist.
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.
Take Buddy's advice and fix it.
I've made the changes. |
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.
Good job! 🚀
No description provided.