London | 26-Jul-SDC | Alex Jamshidi | Sprint 5 | Prep Exercises - #680
Open
Alex-Jamshidi wants to merge 46 commits into
Open
London | 26-Jul-SDC | Alex Jamshidi | Sprint 5 | Prep Exercises#680Alex-Jamshidi wants to merge 46 commits into
Alex-Jamshidi wants to merge 46 commits into
Conversation
…d through functions as arguments - also fixed an if boolean
LonMcGregor
reviewed
Sep 7, 2026
LonMcGregor
left a comment
Contributor
There was a problem hiding this comment.
Good work on these tasks. Most of them are good, I have a few questions about some of them
| # 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 |
Contributor
There was a problem hiding this comment.
Could you expand on these explanations or think of any other benefits / drawbacks?
| def is_adult(self): | ||
| dob = self.dob | ||
| today = date.today() | ||
| if dob.year > today.year - 18: return False |
Contributor
There was a problem hiding this comment.
This sequence of if conditions feels a little complicated. Is there anything you could change to improve it / make it more readable / simplify it?
| # 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 |
Contributor
There was a problem hiding this comment.
When I run this I get two empty lists. Is that the expected output?
| 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.") |
Contributor
There was a problem hiding this comment.
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?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Learners, PR Template
Self checklist
Task code
CYF-1155
Changelist
Exercises from sprint 5 prep completed