I need all possible combinations of 0,1 of length k.
Suppose k=2 I want (0,0), (0,1), (1,0), (1,1)
I have tried different function in itertools
but I did not find what I want.
>>> list(itertools.combinations_with_replacement([0,1], 2))
[(0, 0), (0, 1), (1, 1)]
>>> list(itertools.product([0,1], [0,1])) #does not work if k>2
[(0, 0), (0, 1), (1, 0), (1, 1)]