I've tried multiple code to calculate execution time for a numerical sample of an algorithm in python

the first one(%%timeit) gives the execution time in microsecond however the second one which is shown below give the execution time of the same sample of algorithm in second ( the numerical sample is not generated randomely)

the second code is:

import time

start = time.time()

end = time.time()

total_time = end - start

print("\n"+ str(total_time))

I'm confused there is a significant different between the two results and I hope someone could help me with the correct answer

Similar questions and discussions