Welcome, students! 🚀 This exercise is tailored to enhance your grasp on object-oriented programming, dictionaries, and basic regular expression validation in Python.
- Implement and comprehend the mechanics of a basic library system.
- Develop classes and functions that interact to simulate a library.
- Validate method implementations through testing and debugging.
Your primary working file is exercise.py, which contains stubs for the Book and Library classes. Each class has methods you must implement.
exercise.py also contains a driver() function that demonstrates how each method works and provides log messages to elucidate the expected behavior of each method.
As you go about implementing each method, you can uncomment its respective lines in the driver() function to validate its functionality.
While inside exercise.py:
- Go through each function's docstrings to understand the desired implementation.
- Run the command:
python exercise.py- Also run before starting on the terminal
pytestYou should run this after completing each function to verify that it was correctly implemented. Once all tests pass you can submit your code for review.
Implement each function in the TODO. Do the following steps:
- Add your implementation
- Uncomment corresponding section on driver() and run
python exercise.pyto make sure it works as you intenteded. - Run
pytestto make sure it passsed the tests
Once all the tests have completed:
- Stage Changes:
- View your changes in the Source Control view.
- Click on the
+(plus) sign next to the files you wish to stage.
- Commit Changes:
- Enter a descriptive commit message.
- Press
Ctrl + Enter(orCmd + Enteron macOS) to commit the changes.
- Push Changes:
- Click on the ellipsis
...in the Source Control view. - Select Push.
- Click on the ellipsis
- Verify you code has passed:
- OOP in Python: Review foundational knowledge with Python’s OOP documentation
- Clarifications: Don’t hesitate to ask for clarifications regarding the functionality of the on Discord.
- Debugging: If you’re grappling with bugs or issues, seek help! Debugging is key to learning.
- Answer: We have a file called the_answer.py. Only look at it if you are stuck for some time (30 min+)
Should your functions exhibit unexpected behaviors or issues:
- Place breakpoints in your code within VSCode.
- Use the VSCode debugger to navigate through your code, inspect variables, and diagnose potential issues.
- Modify your code as needed, guided by your findings during debugging.
- Debugger Tutorial