Python Programming - Exception Handling - Discussion

Discussion Forum : Exception Handling - General Questions (Q.No. 4)
4.
In Python, what is the purpose of the else block in exception handling?
It is executed if an exception occurs
It is used to define custom exception classes
It is executed if no exception occurs in the try block
It is used to raise exceptions
Answer: Option
Explanation:
The else block is executed only if no exceptions are raised in the associated "try" block. It is used to specify code that should run when there are no exceptions.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.