Python基础 · free preview
Defensive Programming
Explain what an assertion is. Add assertions that check the program's state is correct. Correctly add precondition and postcondition assertions to functions. Explain what test-driven development is, and use it when creating new functions. Explain why variables should be initialized using actual data values rather than arbitrary constants.
1. Overview
Overview
2. Assertions
Assertions
3. Test-Driven Development
Test-Driven Development
4. Pre- and Post-Conditions
Pre- and Post-Conditions
5. Testing Assertions
Testing Assertions
Practice this interactively
Free account · instant grading · spaced review that schedules itself.
Start this course for free