Python Programming - Exception Handling - Discussion
Discussion Forum : Exception Handling - General Questions (Q.No. 14)
14.
Consider the following Python code:
try:
value = int("abc")
except ValueError:
result = "Invalid conversion"
finally:
result += " - Finally block executed"
What will be the value of "result" after the execution of this code?
Answer: Option
Explanation:
The
finally
block is executed regardless of whether an exception occurs or not. It appends " - Finally block executed" to the "result" string.
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers