0

I want to replicate the cartesian product of [False,True] n times so that the output should be for example with n=3:

[(False, False, False),(False, False, True),(False, True, False),
(False, True, True),(True, False, False),(True, False, True),
(True, True, False),(True, True, True)]

I found how to do it with:

from itertools import product
list(product([False,True],[False,True],[False,True]))

But the thing is that I want to do it for bigger n without writing n times the boolean.

Arli94
  • 680
  • 2
  • 8
  • 19

0 Answers0