Skip to content

London | 26-Jul-SDC | Alex Jamshidi | Sprint 5 | Prep Exercises - #680

Open
Alex-Jamshidi wants to merge 47 commits into
CodeYourFuture:mainfrom
Alex-Jamshidi:prep-exercises
Open

Alex-Jamshidi wants to merge 47 commits into
CodeYourFuture:mainfrom
Alex-Jamshidi:prep-exercises

Conversation

@Alex-Jamshidi

Copy link
Copy Markdown

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

Task code

CYF-1155

Changelist

Exercises from sprint 5 prep completed

@Alex-Jamshidi Alex-Jamshidi added 📅 Sprint 5 Assigned during Week 5 of this module Module-Tools The name of the module. labels Sep 1, 2026
@Alex-Jamshidi Alex-Jamshidi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Sep 1, 2026

@LonMcGregor LonMcGregor left a comment

Copy link
Copy Markdown
Contributor

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. Most of them are good, I have a few questions about some of them

Comment thread sprint-5-prep-exercises/exercise_06.py Outdated
# Think of the advantages of using methods instead of free functions. Write them down in your notebook.

# Better readability of code
# Encapsulation of that function only to class - cleaner and better security. No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you expand on these explanations or think of any other benefits / drawbacks?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have expanded the explanations

Comment thread sprint-5-prep-exercises/exercise_07.py Outdated
def is_adult(self):
dob = self.dob
today = date.today()
if dob.year > today.year - 18: return False

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This sequence of if conditions feels a little complicated. Is there anything you could change to improve it / make it more readable / simplify it?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I couldn't find a way to simplify it with the existing methodology, however I discovered tuples, which allows the comparison of the year/month/day all the the same time using comparison operators (if the year is the same, check month, if that's the same check the day)

Comment thread sprint-5-prep-exercises/exercise_10.py Outdated
# exercise_10.py:29: error: Unexpected keyword argument "preferred_operating_system" for "Person"; did you mean "preferred_operating_systems"? [call-arg]
# exercise_10.py:30: error: Unexpected keyword argument "preferred_operating_system" for "Person"; did you mean "preferred_operating_systems"? [call-arg]

# Fix all of the places that mypy tells you need changing. Make sure the program works as you’d expect. No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When I run this I get two empty lists. Is that the expected output?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ah woops.

The preferred_operating_systems is a list of strings and the operating system of a laptop is a string, I was doing a like for like comparison == instead of checking if the list includes the string. Updating using python 'in' operator.

Comment thread sprint-5-prep-exercises/exercise_11.py Outdated
user_operating_system_str = input("Please enter your preferred operating system (options: ARCH, UBUNTU, MACOS, WINDOWS):\n")

if user_operating_system_str not in OperatingSystem.__members__:
sys.exit("Error: Operating system should be written in all caps from given options.")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there any change you could make to the UX to make this more forgiving, rather than requiring the user to write their input in such a strict format?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, I have converted all inputs into uppercase so that is no longer a requirement to select an operating system

@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. labels Sep 7, 2026
@Alex-Jamshidi Alex-Jamshidi 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 Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Tools The name of the module. Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 📅 Sprint 5 Assigned during Week 5 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants