Advertisement
nikgol

Untitled

Jan 17th, 2022
658
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import timeit
  2.  
  3. code_to_test = """for i in range(2, 10000):
  4.    s = 0
  5.    for j in range(1, i // 2 + 1):
  6.        if not i % j:
  7.            s += j
  8.    if s == i:
  9.        print(i, end=" ")"""
  10. elapsed_time = timeit.timeit(code_to_test, number=1)
  11. print(elapsed_time)
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement