What will be the output of the following Python code?

def a():
    try:
        f(x, 4)
    finally:
        print('after f')
    print('after f?')
a()

a) No output
b) after f?
c) error
d) after f

1 thought on “What will be the output of the following Python code?”

  1. c
    Explanation: This code shown above will result in an error simply because ‘f’ is not defined. ‘try’ and ‘finally’ are keywords used in exception handling.

Leave a Comment