You are doing something else wrong - although the number of combinations is large, in my system itertools.product generated the 400,000+ possible combinations in this case in less than 0.1 second.
What do you call "not working properly"? Remember that itertools returns a tuple with the 4 letters, you have to make some other call to join the letters in a word:
In [73]: c = [''.join(b) for b in itertools.product(a, repeat=4)]
In [74]: len(c)
Out[74]: 456976
In [76]: print(c[0:50])
['aaaa', 'aaab', 'aaac', 'aaad', 'aaae', 'aaaf', 'aaag', 'aaah', 'aaai', 'aaaj', 'aaak', 'aaal', 'aaam', 'aaan', 'aaao', 'aaap', 'aaaq', 'aaar', 'aaas', 'aaat', 'aaau', 'aaav', 'aaaw', 'aaax', 'aaay', 'aaaz', 'aaba', 'aabb', 'aabc', 'aabd', 'aabe', 'aabf', 'aabg', 'aabh', 'aabi', 'aabj', 'aabk', 'aabl', 'aabm', 'aabn', 'aabo', 'aabp', 'aabq', 'aabr', 'aabs', 'aabt', 'aabu', 'aabv', 'aabw', 'aabx']
What is the error? The function appears to work perfectly.
– José
Apparently you saw that the
product
did not return a list and assumed that "gave probledúsma because it is too big". Tip to be able to do cool things in programming: try and try. If you suspected that the problem was "ours," that’s a lot," you should have tried with a smaller set of data to see if it worked. Then I’d know that wasn’t the problem.– jsbueno
-1 : The question is bad, "Does not work correctly" is very vague. If edit and better elaborate the question (preferably with examples of the problem found) I withdraw my negative vote.
– nosklo
I found that the problem was in the IDE,she couldn’t show the complete list, so when I typed a random word it didn’t show up
– x8ss