On Tuesday, November 23, 2010 02:01:40 pm Mac Ryan wrote:
> The code you wrote generates programs like:
>
> for l0 in alphabet:
> for l1 in alphabet:
> for l2 in alphabet:
> word = "".join([eval("l"+str(i)) for i in range(n)])
> listOfWords.append(word)
>
> wh
"Mac Ryan" wrote
I am not 100% sure I got the terms of your problem and I am neither
an
official tutor of this list, so disregard my comment if it is
irrelevant...
If you are a member of the list and contribute you are an official
tutor.
There are no high priests here :-)
Alan G.
_
You can always substitute Iteration for Recursion by making the stack an
explicit part of your code. As an example, imagine you are traversing this
directory tree:
birds
birds/owls
birds/owls/snowy
birds/owls/barn
birds/owls/great-horned
birds/eagles
birds/eagles/golden
birds/eagles/bald
birds/e
On Tue, 23 Nov 2010 13:16:46 +
Jose Amoreira wrote:
> I read somewhere that for any recursive algorithm there is a
> sequential one that is equivalent
> [...]
> Is there a more straightforward way of solving my specific problem
> or, better yet, a general solution to the need of a variable nu
On Tue, Nov 23, 2010 at 2:16 PM, Jose Amoreira wrote:
> Is there a more straightforward way of solving my specific problem or, better
> yet, a general solution to the need of a variable number of for loops?
If you need a variable number of loops, put the loops themselves in a
loop, which you go
Hi,
This is a somewhat algorithmic question, not strictly pythonic. I was writing
a program to generate all possible n-letter words with letters taken from an
alphabet (I mean, if the alphabet is ['a','b'] the one-letter words are 'a'
and 'b', the two letter words are 'aa', 'ab', 'ba', 'bb' and