Code defensively with best practices
Intermediate
Developer
Student
Visual Studio Code
Learn how to write defensive Python code using best practices including conventions, documentation, error handling, and unit testing.
Learning objectives
After you complete this module, you'll be able to:
Follow Python conventions and write readable code.
Document your code with docstrings and type hints.
Validate input and handle exceptions with try and except.
Write and run effective unit tests.
Refactor existing code to apply defensive programming best practices.
Prerequisites
Beginner-level experience with Python programming
Familiarity with defining and calling functions
Experience writing and running Python code