Consider the following try… except… else… instruction: try: … except: … else: … Select correct statement.

Questions & AnswersCategory: PythonConsider the following try… except… else… instruction: try: … except: … else: … Select correct statement.
Lokesh Kumar Staff asked 2 years ago

Consider the following try... except... else... instruction:

try:
    ...
except:
    ...
else:
    ...

Select correct statement.
a. If the code in the try block executes correctly and no exception is raised, the code after the else statement is not executed.
b. If the code in the try block executes correctly and no exception is raised, the code is executed after the else statement, and only in this case.

1 Answers
Lokesh Kumar Staff answered 2 years ago

b. If the code in the try block executes correctly and no exception is raised, the code is executed after the else statement, and only in this case.