πŸ“Š Python
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
πŸ’¬ Discuss
βœ… Correct Answer: (B) 2

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
210
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Durgesh
Publisher
πŸ“ˆ
99%
Success Rate