CPU Time

CPU time vs Wall time as explained earlier here in the Fortran section discussing the same exact thing can be calculated when done in python in the following way

import time 
start = time.process_time()
# code to time 
end = time.process_time()
cpu_time = end - start 

wall time gives you total elapsed time including time spent by process waiting for resources like processor, network , and I/O devices so usually CPU time < wall time.

But one of the best ways to measure time in Python is to use the built-in timeit module. This is designed to time your program as a whole.

python3 -m timeit example.py