Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from itertools import product
- import string
- import time
- import bisect
- x1 = list(product(string.digits, repeat=8))
- x2 = set(x1)
- a = time.time()
- if ('8', '2', '3', '2', '2', '9', '9', '9') in x1:
- print("jest")
- print(time.time()-a)
- a = time.time()
- if ('8', '2', '3', '2', '2', '9', '9', '9') in x2:
- print("jest")
- print(time.time()-a)
- a = time.time()
- indx = bisect.bisect_left(x1,('8', '2', '3', '2', '2', '9', '9', '9'))
- if ('8', '2', '3', '2', '2', '9', '9', '9') == x1[indx]:
- print("jest")
- print(time.time()-a)
- # jest
- # 62.467647075653076
- # jest
- # 0.0003457069396972656
- # jest
- # 0.009447336196899414
Advertisement
Add Comment
Please, Sign In to add comment