def foo(): try: return 1 finally: return 2 k = foo() print(k)
a) 1
b) 2
c) 3
d) error, there is more than one return statement in a single try-finally block
def foo(): try: return 1 finally: return 2 k = foo() print(k)
a) 1
b) 2
c) 3
d) error, there is more than one return statement in a single try-finally block
You must be logged in to post a comment.
b
Explanation: The finally block is executed even there is a return statement in the try block.