Advertisement
zhukov000

measure of execution time

Nov 2nd, 2019
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.23 KB | None | 0 0
  1. import timeit
  2. # code for test:
  3. code_to_test = """
  4. a = range(4000000)
  5. b = []
  6. for i in a:
  7.    b.append(i*2)
  8. """
  9. #
  10. try_counts = 10
  11. elapsed_time = timeit.timeit(code_to_test, number=try_counts) / try_counts
  12. print(elapsed_time)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement