Python Programming - Exception Handling - Discussion

Discussion Forum : Exception Handling - General Questions (Q.No. 10)
10.
What is the purpose of the finally block in Python exception handling?
Define custom exception classes
Terminate the program
Execute code regardless of whether an exception is raised or not
Raise exceptions intentionally
Answer: Option
Explanation:
The finally block contains code that will be executed no matter what, whether an exception is raised or not. It is useful for cleanup operations or releasing resources.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.