Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

London | SDC-Nov-2025| Ikenna Agulobi | Sprint 5| Prep exercise python #312

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

Open
ike-agu wants to merge 15 commits into CodeYourFuture:main
base: main
Choose a base branch
Loading
from ike-agu:prep_exercise_python

Conversation

@ike-agu
Copy link

@ike-agu ike-agu commented Dec 28, 2025

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 my sprint 5 prep exercises:

  • Why we use types
  • Type checking with mypy
  • Classes and Objects
  • Methods
  • Data classes
  • Generics
  • Type guided refactoring
  • Enums
  • Inheritance

ike-agu added 12 commits December 22, 2025 02:06

This comment has been minimized.

@ike-agu ike-agu changed the title (削除) London | SDC-Nov-2025| Ikenna Agulobi | Sprint-5| Prep exercise python (削除ここまで) (追記) London | SDC-Nov-2025| Ikenna Agulobi | Sprint 5| Prep exercise python (追記ここまで) Dec 28, 2025
@ike-agu ike-agu added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Dec 28, 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

ike-agu reacted with thumbs up emoji
Copy link

@LonMcGregor LonMcGregor Jan 14, 2026

Choose a reason for hiding this comment

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

Has this file passed the mypy type checker?

Copy link
Author

Choose a reason for hiding this comment

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

I've added type annotations and fix the bugs to ensure the file passes mypy type checker.

Copy link

@LonMcGregor LonMcGregor Jan 14, 2026

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

@ike-agu ike-agu Jan 20, 2026
edited
Loading

Choose a reason for hiding this comment

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

A function is standalone code with its own behaviour, while a class method is code whose behaviour belongs to an object or class and operates on its internal state.

------Advantages of using methods: ---------
• Ease of documentation and discoverability
Attaching behaviour to a type makes it easier to find and understand all operations related to that type. For example, methods on str or Person group related functionality together, rather than scattering it across separate functions.
• Encapsulation
Methods hide the internal representation of a type. If the implementation of Person changes (e.g. storing a date of birth instead of an age), the code that uses Person does not need to change, and it is clearer which methods may need updating internally.
• Improved readability
Methods read like natural language and make code easier to understand e.g is_adult(Imran)

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

@LonMcGregor LonMcGregor Jan 14, 2026

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.

I've now fix my code and family tree prints children recursively. Thank you for your review and feedback

if best_os != person.preferred_operating_system and best_count > preferred_count:
print(
f"If you are willing to accept {best_os.value} instead,"
f"You're more likely to get a laptop. {best_count} available)."
Copy link

@LonMcGregor LonMcGregor Jan 14, 2026

Choose a reason for hiding this comment

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

I think you have an extra bracket here you dont need

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for catching that. I've now fixed the output message formatting by removing the extra parenthesis.

@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
Copy link
Author

ike-agu commented Jan 20, 2026

@LonMcGregor ,Thank you for taking the time to review my PR and providing helpful feedbacks. I'v fixed the changes you pointed out. When you will be available, could you take another look.

@ike-agu ike-agu added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jan 20, 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.

Good work on these tasks, it is complete now

@LonMcGregor LonMcGregor added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed 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. labels Jan 20, 2026
Copy link
Author

ike-agu commented Jan 20, 2026

@LonMcGregor Thank you for taking the time to review my PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@LonMcGregor LonMcGregor LonMcGregor left review comments

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /