I have this code:
from itertools import permutations
lizt = [(1,2,3), (1,3,4), (6,5,3), (2,5,3), (1,6,2), (4,1,6)]
lizt = list(permutations(lizt, 3))
for i in lizt:
print(i)
print(' ')
But I want to print out the possible permutation only if the numbers 1-6 exist somewhere in one of the three tuples.
For instance, I want this:
((1, 6, 2), (2, 5, 3), (4, 1, 6))
bcause it has all numbers somewhere in there, but I dont want this:
((1, 2, 3), (1, 3, 4), (1, 6, 2))
because it is missing the 5. How can I do this?