Assert Statements
Debugging with assertions
Interview Relevant: Debugging techniques
Assert
Verify conditions during development.
Code Examples
python
1def discount(price, percent):
2 assert 0 <= percent <= 100, "Invalid discount"
3 return price * (1 - percent/100)