# | Likes | Tech tags | Title | Creator | Created date |
---|---|---|---|---|---|
1 | 0 |
2023-01-28 21:13
|
Measures the running time of a snippet of code using the time.time
function from the python standard library
from time import time
t = time() # Timepoint before execution
a = [i*275 % 1000000007 for i in range(10000000)]
time_in_secs = time() - t
print('Execution took', time_in_secs, 'seconds')
functions | |
range |
docs.python.org |
time.time |
docs.python.org |
Run some demanding code snippet and measure how long it takes to execute.