Source Code:
(back to article)
import time # Record the start time start = time.perf_counter() # Run the code that you want to measure i = 1 for i in range(100000): i += 1 # Record the end time end = time.perf_counter() # Calculate the elapsed time elapsed = end - start print(f'Elapsed time: {elapsed:.6f} seconds')
Result:
Report an issue