For this input list
[0, 1, 2, 3, 4, 5]
I need this output
[[0, 2],
[0, 3],
[0, 4],
[0, 5],
[1, 3],
[1, 4],
[1, 5],
[2, 4],
[2, 5],
[3, 5],
[0, 2, 3],
[0, 3, 4],
[0, 4, 5],
[1, 3, 4],
[1, 4, 5],
[2, 4, 5],
[0, 2, 3, 4],
[0, 3, 4, 5],
[1, 3, 4, 5]]
I have tried this code,
for k in range( 0, 5 ):
for i in range( len( inputlist ) - ( 2 + k ) ):
print [inputlist[k], inputlist[i + ( 2 + k )]]
for i in range( len( inputlist ) - ( 3 + k ) ):
print [inputlist[k], inputlist[i + ( 2 + k )], inputlist[i + ( 3 + k )]]
for i in range( len( inputlist ) - ( 4 + k ) ):
print [inputlist[k], inputlist[i + ( 2 + k )], inputlist[i + ( 3 + k )], inputlist[i + ( 4 + k )]]
I need skipped patterns, 1,2,3 --> 1,3 1,2,3,4 --> [1,3],[1,4],[2,4]
ie, first element, third element and so on.
How to generalize this? Help is appreciated
Try to describe with words your problem.
From what I understand from your example: