Generating Two-dimensional Array Of Binaries In Python
So this is what im trying list(itertools.combinations_with_replacement('01', 2)) but this is generating [('0', '0'), ('0', '1'), ('1', '1')] I still need a ('1','0') tuple, is the
Solution 1:
Use itertools.product
instead:
>>> import itertools
>>> list(itertools.product('01', repeat=2))
[('0', '0'), ('0', '1'), ('1', '0'), ('1', '1')]
Post a Comment for "Generating Two-dimensional Array Of Binaries In Python"