[Tutor] dealing with lists

Mark Lawrence breamoreboy at gmail.com
Wed Feb 23 17:56:22 EST 2022


On 23/02/2022 22:21, Alan Gauld via Tutor wrote:
> On 23/02/2022 20:11, marcus.luetolf at bluewin.ch wrote:

[snipped to hell]

>>
>> I  would liketo  distribute all 16 characters to the 4 sublists 5 times in 5
>> iterations respectivly  so that as a condition a pair of characters,
>> p.e. ['a', 'b', .]  or ['a', 'c'.] or ['n', 'p' .] can appear only once
>> in all 20 sublists.
> 
> You can probably use some of the python modules to do that
> for you as a set of combinations or permutations or whatever
> you actually want.
> 

https://docs.python.org/3/library/itertools.html#itertools.combinations
https://docs.python.org/3/library/itertools.html#itertools.permutations

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence



More information about the Tutor mailing list