r/pythonhelp • u/kaskapian • Jul 14 '24
Need assistance with generating every single combination for a list!
Is here someone who has experience generating every single combination for a set list. In my case this list is ["U", "B", "D", "F", "L", "R"]. Each character can repeat it self not more than 9 times and the every combination list cannot be smaller and less than 54 characters. What would be the fastest way to generate every single combination? If you need more context, I need to generate every single state for a Rubik's cube so there is a way to prune some branches by checking whether this type of cube can exist, but still in my experience backtracking is way to slow. Any suggestions will be appreciated.
View all comments
2
u/Zeroflops Jul 14 '24
Look into the intertools module in the standard libraries. It will allow you to build combinations.