[Tutor] computation problem

marcus.luetolf at bluewin.ch marcus.luetolf at bluewin.ch
Sun Nov 28 14:14:08 EST 2021


Hello Experts

 

I'd like to write a python code to find all possible combinations of a list
of n items.

If, for example, a list L consists of 4 items, n = 4,  L = ['abcd'], the
code should print out 24 different combinations from ['abcd'] to ...['dcba']

 

I tried several solutions posted on stackoverflow  using itertools  but none
gave the sought for combinations.

 

I'm aware the complexity of a a code using for loops might be exponential .

 

Could anybody tell me a text or tutorial how to approach tist task by python
?

 

 



More information about the Tutor mailing list