You can use the time module to determine the time to execute a code. This is a fairly simple method. You can use the time() method to save the timestamp when the code starts running. Similarly, save the ending timestamp using the time() method again. The difference between the timestamps gives you the time taken for execution.