simple recursion help

Alex Martelli aleaxit at
Sat Oct 23 23:40:35 CEST 2004

Steven Bethard <steven.bethard at> wrote:

> drs <drs <at>> writes:
> > 
> > I am looking for a list of all unique strings of length x whose
> > elements are from the set a, b, and c.
> Does anyone know what this operation is called?  It's not permutations or
> combinations as I understand them since permutations and combinations do
> not allow repetition.  I assume there was already a solution for this
> somewhere, but I didn't know what term to google for.

There's been a recent thread where the OP called them 'permutations',
somebody commented they're 'variations'.  In that thread you'll find a
bazillion solutions, recursive and non, with or without itertools, &c.


More information about the Python-list mailing list