October 2018
Beginner to intermediate
676 pages
18h 30m
English
To simulate exceptions, we will start a loop that runs until an exception happens, capture the exception, trigger the appropriate callback response function, and finally close the program.
For the KeyboardInterrupt exception, once the program starts, you will see * in the Input cell of your notebook, click on Kernel tab on the top of your notebook and press the interrupt option in the drop-down box.
If there is no KeyboardInterruption for 30 seconds, then it will execute the code, which results in a DivideByZero exception.
Import the required libraries:
import time
Read now
Unlock full access