Guest User

Untitled

a guest
Nov 6th, 2022
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. from itertools import product
  2. import string
  3. import time
  4. import bisect
  5.  
  6. x1 = list(product(string.digits, repeat=8))
  7. x2 = set(x1)
  8.  
  9. a = time.time()
  10. if ('8', '2', '3', '2', '2', '9', '9', '9') in x1:
  11.     print("jest")
  12. print(time.time()-a)
  13.  
  14. a = time.time()
  15. if ('8', '2', '3', '2', '2', '9', '9', '9') in x2:
  16.     print("jest")
  17. print(time.time()-a)
  18.  
  19. a = time.time()
  20. indx = bisect.bisect_left(x1,('8', '2', '3', '2', '2', '9', '9', '9'))
  21. if ('8', '2', '3', '2', '2', '9', '9', '9') == x1[indx]:
  22.     print("jest")
  23. print(time.time()-a)
  24.  
  25.  
  26. # jest
  27. # 62.467647075653076  
  28. # jest
  29. # 0.0003457069396972656
  30. # jest
  31. # 0.009447336196899414
Advertisement
Add Comment
Please, Sign In to add comment