I have a list of unique tuples each containing 2 elements from 1 to 10. A total number of elements in a list is 45. I would like to divide them into 10 groups each of them containing only numbers from 1 to 10.
I have tried solve my problem using this answer: python get groups of combinations that each member appear only once
python:
from itertools import combinations, chain
l = ['A','B','C','D','E', 'F', 'G','H','I','J']
c = list(combinations(l,2))
[set(i) for i in list(combinations(c,5)) if (len(set(l) & set(chain(*i))) == len(l))]
But I get repetitions, like so:
[{('A', 'B'), ('C', 'D'), ('E', 'F'), ('G', 'H'), ('I', 'J')},
{('A', 'B'), ('C', 'D'), ('E', 'F'), ('G', 'I'), ('H', 'J')},...]