-
What Python statements should you put inside the
try block of a
try/except statement.
any statement that can cause a runtime error
-
What Python statements should you put inside the
except block of a
try/except statement.
statements that deal with the runtime error
-
When the Python interpreter comes across a runtime error inside the
try bloc of a
try/except statement, what does the interpreter do?
the interpreter stops executing the code inside the try block
and executes the code in the corresponding except block
-
Can there be different
except clauses for different exceptions?
yes
-
If the code inside the
try block can create more than one type of
runtime error, what must you do if you want to do different things for each possible runtime error?
create an except block for each possible exception type
-
What happens whenever the Python interpreter runs some code that causes a runtime error?
it creates an exception object
-
If you had an
except block that began
except ValueError val_err:
how would you print the error message contained in the exception object?
print(val_err)
-
When is the code in the
else block of a try/except statement
executed?
after all the statements in the try block have run
without raising an exception
-
When is the code in the
finally block of a try/except statement
executed?
after all the statements in the try block and
all exception handlers have run
-
What do you call the statements inside an
except block?
the exception handler