I am working on combination using Python. Let's say I have the following list:
List = ['AW','BW','CW','DW','EW','FW','GW','HW']
I am creating combinations for any 3 as follows:
Perm =combinations( List,3)
Com = []
for i in list(Perm):
#print (i)
Com.append(i)
I got the following output with 56 combinations:
I want to remove the combinations with the following conditions:
Both
List [0]andList [1]contains in a combination (i.e. I want the combinations with only one of these two to contain in a combination.)Both
List [2]andList [3]contains in a combination (i.e. I want the combinations with only one of these two to contain in a combination.)Both
List [4]andList [5]contains in a combination (i.e. I want the combinations with only one of these two to contain in a combination.)
It means only one of two subsequent component () of list to be contained in a combination.
I have attached the picture and highlighted the combinations to be removed as examples.
How can I do this?

