English

When will the else part of try-except-else be executed?

Advertisements
Advertisements

Question

When will the else part of try-except-else be executed?

Options

  • always

  • when an exception occurs

  • when no exception occurs

  • when an exception occurs into except block

MCQ
Advertisements

Solution

when no exception occurs

Explanation:

If there is no exception, the else portion is carried out.

shaalaa.com
Handling Exceptions in Python
  Is there an error in this question or solution?
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×