1 2 3 4 5 6 7 8 9 10 11 12
from itertools import product ## nInput = 2 ## Example 1 nInput = 3 ## Example 2 arrStrOutput = [] for arrIndx in product(range(2), repeat = nInput): arrStrOutput.append("".join([str(nIndx) for nIndx in arrIndx])) print (arrStrOutput)