Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import itertools
- import time
- start = time.time()
- locs = ['A Obj1', 'A Obj2',
- 'B Obj1', 'B Obj2',
- 'C Obj1', 'C Obj2',
- 'D Obj1', 'D Obj2']
- p = itertools.combinations(locs,2)
- n = 0
- for p in p:
- if not (locs[0] in p and locs[1] in p):
- if not (locs[2] in p and locs[3] in p):
- if not (locs[4] in p and locs[5] in p):
- if not (locs[6] in p and locs[7] in p):
- n += 1
- print(p)
- fin = time.time() - start
- print('%i total combinations found in %.4f seconds' %(n, fin))
Advertisement
Add Comment
Please, Sign In to add comment