finallyIntermediate Playground

Block that always executes after try/except, used for cleanup

Python Playground
Output
Click "Run" to execute your code

finally runs even when the try block returns. If finally also has a return, it overrides the try's return — avoid this anti-pattern.

Challenge

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