Skip to content

Conversation

@AFatmaa
Copy link

@AFatmaa AFatmaa commented Oct 26, 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 includes all the exercises from the “03 Prep Exercises” section of the Decomposition Sprint.
Each exercise is completed in a separate Python file with type annotations and learning notes.

Questions

I don’t have any questions. Thank you.

@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@AFatmaa AFatmaa added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Decomposition The name of the module. labels Oct 26, 2025
@LonMcGregor LonMcGregor added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Oct 29, 2025
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 start on this sprint's tasks, I have spotted a few areas where you could improve code further

return number * 3

print(double1(10))
# When you check the function name, it doesn’t fit what we have to expect.

Choose a reason for hiding this comment

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

Can you suggest a better name?

Copy link
Author

Choose a reason for hiding this comment

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

A better name would be triple, since it multiplies by 3. I’ve added a short comment in the code. Thanks 🙏


# I learned that a class defines what attributes each object will have.
# Mypy can check if I try to access an attribute that doesn't exist.
# It helps to avoid mistakes like typing person.addres instead of person.address.

Choose a reason for hiding this comment

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

In this case, is there a difference between person.addres and person.address?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, there is.

person.address would work only if the Person class actually had an attribute called address, but person.addres (with the typo) doesn’t exist. So mypy can catch that before running the code.

generics.py Outdated
@dataclass(frozen=True)
class Person:
name: str
age: int

Choose a reason for hiding this comment

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

Can you solve this in a way that it always prints the current age, rather than hard-coding a specific age?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, we can solve this by calculating the age based on the birth year.
I added this feature to my code, so now the age is always updated automatically according to the current year.

Thank you! 🙌

@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 Oct 29, 2025
@AFatmaa
Copy link
Author

AFatmaa commented Nov 9, 2025

Hi @LonMcGregor,
Thank you for the feedback! 🙌
I’ve reviewed all your comments and updated my code accordingly.
Could you please check it again when you have a moment?

@AFatmaa AFatmaa added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Nov 9, 2025
@github-actions
Copy link

github-actions bot commented Nov 9, 2025

Your PR couldn't be matched to an assignment in this module.

Please check its title is in the correct format, and that you only have one PR per assignment.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

1 similar comment
@github-actions
Copy link

github-actions bot commented Nov 9, 2025

Your PR couldn't be matched to an assignment in this module.

Please check its title is in the correct format, and that you only have one PR per assignment.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@LonMcGregor
Copy link

Good work updating this, you're done with this task 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. labels Nov 10, 2025
@github-actions
Copy link

Your PR couldn't be matched to an assignment in this module.

Please check its title is in the correct format, and that you only have one PR per assignment.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

1 similar comment
@github-actions
Copy link

Your PR couldn't be matched to an assignment in this module.

Please check its title is in the correct format, and that you only have one PR per assignment.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@AFatmaa
Copy link
Author

AFatmaa commented Nov 10, 2025

Thank you @LonMcGregor 🌸

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

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed. Module-Decomposition The name of the module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants