A

Admin • 832.27K Points
Coach

Q. What will be the output of the following Python code?

Code:
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
  • Correct Answer - Option(B)
  • Views: 27
  • Filed under category Python
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.