try — Advanced Playground
Starts a block of code that will be monitored for exceptions
Python Playground
Output
Click "Run" to execute your code'raise X from Y' sets __cause__ for explicit chaining. __context__ is set automatically when an exception occurs while handling another.
Challenge
Try modifying the code above to explore different behaviors. Can you extend the example to handle a new use case?