Sobes.tech
Junior — Senior

What will be the output of a function using try‑finally?

livecode

Task condition

Determine what will appear in the console output after executing the following code. In the example, the function contains a try block and a finally block, each of which returns a value.


def func():
    try:
        return 1
    finally:
        return 2

print(func())