[Solved] Getting all ordered sublists of ordered lists


from itertools import combinations, permutations


perm=[]
index = [9,7,6,5,2,10,8,4,3,1]
perm.append(index)
M = 3
slicer = [x for x in combinations(range(1, len(index)), M - 1)]
slicer = [(0,) + x + (len(index),) for x in slicer]

result = [tuple(p[s[i]:s[i + 1]] for i in range(len(s) - 1)) for s in slicer for p in perm]

1

solved Getting all ordered sublists of ordered lists