Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

What does the else clause of a try statement do?

  1. A Runs only if no exception was raised in the try block
  2. B Runs whether or not an exception occurred
  3. C Runs only when an exception occurs
  4. D Is invalid syntax
Answer

Runs only if no exception was raised in the try block

The else block keeps the try block minimal, so it cannot accidentally catch an exception from unrelated follow-up code.

All Python MCQs

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as