i'm lost in list manipulation

Scott David Daniels Scott.Daniels at Acm.Org
Wed Mar 3 18:01:33 CET 2004


GrelEns wrote:

> hello,
> 
> having a list like ['a', 'b', 'c', 'd'] i would like to get
> 
> [['a', '-', 'b', 'c', 'd'],
> ['a', 'b', '-', 'c', 'd'],
> ['a', 'b', 'c', '-', 'd'],
> ['a', '-', 'b', '-', 'c', 'd'],
> ['a', 'b', '-', 'c', '-', 'd'],
> ['a', '-', 'b', '-', 'c','-', 'd']]
> 
> that is adding successively an item between at all the available place, and
> i just can't get my brain doing that :(
Maybe:
Think of all possible places.  How many are there?  At each of these
places you either put a dash or not.  Sounds like binary to me.

-- 
-Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list