I want to create a list of all possible booleans with a given length n
, using Python 3.
# suppose n = 2
# the expected output should be
output = [[0, 0], [0, 1], [1, 0], [1, 1]]
In my real application, n
is never larger than 10.
A similar post is here but for Java.
Could you please show me how to do it in Python 3? Thanks in advance.