Congratulations, you have now mastered many techniques for interacting with exceptions in Python! We learned:
- How exceptions differ from syntax errors
- How to read tracebacks
finallyprovides us with a powerful control flow for handling exceptions
- How to create and raise custom exceptions to provide more helpful errors to users of our code
These tools will get you very far as a Python developer!
The code in
families.py prints some instruments and the instrument families they belong to. It has some bugs in it. Can you find and fix the bugs? Consider adding some exception handlers so that you can print custom error messages the next time someone runs into these bugs!