let say I have a list of lists
[[a1, a2, a3], [b1, b2], [c1, c2, c3, c4]]
The number of lists in the list is not known in advance.
I want to have all combinations of elements from the different list, so
[a1, b1, c1], [a1, b1, c2], ..., [a3, b2, c4]
but if there common elements in the different list, all these combinations need to be deleted. So if for example, a1 = c2
, then the combinations [a1, b1, c2], [a1, b2, c2]
need to be deleted in the resulting list.
To get all possible combinations, you can use the answer on All possible permutations of a set of lists in Python, but can you automaticaly delete all combinations with common elements?