Let's say I have the following list lst=[1,1,2,2,3,3,4,4,5,5,6,6]
. How can I use itertools to get all possible combinations of 4 numbers? My problem is that there are duplicates which I want to treat as the same subset for example [1,1,2,3]
is the same as [1,1,2,3]
even though the 1's are in different positions they represent the same set. Any idea how to proceed?
Example of what I tried:
listOfCombinations = [x for x in itertools.combination(lst, 5)]