assert — Intermediate Playground
Debugging aid that tests a condition and raises AssertionError if false
Python Playground
Output
Click "Run" to execute your codeassert is ideal for checking invariants during development. Use it for conditions that should never be false in correct code.
Challenge
Try modifying the code above to explore different behaviors. Can you extend the example to handle a new use case?