The execution order of exception handling blocks is non-obvious and regularly tested in senior interviews

Most developers use try/except regularly. Fewer can predict the exact execution order when you combine try, except, else, and finally in a single block, especially when return statements or nested exceptions are involved.

The Complete Structure

try:

# code that might raise an exception