How program a particilar algorithm ?
Matt Gerrans
mgerrans at ix.netcom.com
Wed Nov 14 21:01:54 EST 2001
> > I want to generate all possible lists with elements from another one. For
> > example, from a list like [1,2,3,4] i want to program an algorithm which
> > will give this result
> >
> [[1,2],[1,3],[1,4],[1,2,3],[1,2,4],[1,3,4],[1,2,3,4],[2,3],[2,4],[2,3,4],[3,
> > 4]]
>
> Haven't you forgotten [1], [2], [3] and [4]?
And don't forget poor little [ ].
- mfg
More information about the Python-list
mailing list