Skip to content

Conversation

@zohrehKazemianpour
Copy link

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

This PR contains the Sprint 5 preparation exercise.

As I was not previously familiar with Python, it took me some time to get comfortable with the new concepts and syntax. I added as many comments as possible for educational purposes, as I plan to use this code later as a reference.

Questions

I would really appreciate any feedback on my implementation and suggestions on how I can improve my code quality.

@zohrehKazemianpour zohrehKazemianpour added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Dec 16, 2025
@LonMcGregor LonMcGregor added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Jan 14, 2026
Copy link

@LonMcGregor LonMcGregor left a comment

Choose a reason for hiding this comment

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

Very good work on these tasks, there are some areas where you could improve further

Choose a reason for hiding this comment

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

Can you describe the difference and any dis/advantage of using a class method vs a function?

Copy link
Author

Choose a reason for hiding this comment

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

In the prep section, we learned that class methods provide benefits such as encapsulation and improved code organisation compared to free functions. However, overusing class methods can unnecessarily complicate the code. As a rule of thumb, methods should be used when modellingobjects with related state and behavior, while simple, stateless tasks are better implemented as standalone functions.

self.preferred_operating_system = preferred_operating_system

def is_adult(self) -> bool:
today_date = date.today().year

Choose a reason for hiding this comment

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

Be careful about the formatting and indentation here

Copy link
Author

Choose a reason for hiding this comment

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

I removed the extra lines and kept only one line

def print_family_tree(person: Person) -> None:
print(person.name)
for child in person.children:
print(f"- {child.name} ({child.age})")

Choose a reason for hiding this comment

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

Can this print grandchildren recursively?

Copy link
Author

Choose a reason for hiding this comment

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

Sure, at the moment, the function only prints one level. I’ve updated the implementation to print grandchildren recursively as well.

Choose a reason for hiding this comment

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

To improve the user experience, you might want to do some validation on the input and ask for reentry if it is invalid. You might also want to give some options when asking for an OS

@LonMcGregor LonMcGregor added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Jan 14, 2026
@zohrehKazemianpour
Copy link
Author

Very good work on these tasks, there are some areas where you could improve further

Thanks for the review and the positive feedback!

Apologies for the delay in getting back to you. We've had a really busy few weeks focusing on the backend and prepping for our Codility tests. I’m going through your suggestions now and will implement the improvements across the tasks.

@zohrehKazemianpour zohrehKazemianpour added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants