I need to create a ton of lists in Python. Each list has a length of 13, and I have 4 possible values that can go into each item. It is [1, -1, i, -i], but it can be anything.
Thus, I should get 4 * 4 * 4 ... * 4 = 4 ^ 13 = 67,108,864 lists or, more broadly, m ^ n, given the information in the topic.
I tried the combination_with_replacement method in Python itertools, but with the following code, I get only 560 results.
c = it.combinations_with_replacement([1,-1,np.complex(0,1), np.complex(0,-1)], 13)
print list(c)
I know that combinations don't care about order, so this result is probably right. However, when I use the permutation method instead, I can only select the second argument <= the number of elements in the first argument.
Any idea how to do this?
Thank!
source
share