1.

When will the else part of try-except-else be executed?(a) always(b) when an exception occurs(c) when no exception occurs(d) when an exception occurs in to except blockI have been asked this question in unit test.My doubt is from Exception Handling in division Classes and Objects, Inheritance, Polymorphism, Encapsulation and Exception Handling of Python

Answer»

Right answer is (C) when no exception occurs

Best explanation: The ELSE part is EXECUTED when no exception occurs.



Discussion

No Comment Found

Related InterviewSolutions