tryIntermediate Playground

Starts a block of code that will be monitored for exceptions

Python Playground
Output
Click "Run" to execute your code

else runs only if no exception was raised. finally always runs, even if an exception occurs or the function returns. Use finally for cleanup.

Challenge

Try modifying the code above to explore different behaviors. Can you extend the example to handle a new use case?