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 there a way to make itertools also do combinations and order?
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 there a way to make itertools also do combinations and order?
Use itertools.product instead:
>>> import itertools
>>> list(itertools.product('01', repeat=2))
[('0', '0'), ('0', '1'), ('1', '0'), ('1', '1')]