python - get all possible combinations with replacement without recursion
<p>In python, how can I write a function that get some number n and print all possible words(a-z) permutations(with replacement) when <code>length=n</code>.</p>

<p>Without using recursion and without using external functions like <code>itertools.permutations</code>, <code>itertools.combinations</code> etc..</p>

<p>For example:
<code>n=2</code> should print </p>

<pre><code>aa ba ... za
ab bb ... zb
...
az bz ... zz
</code></pre>

<p><code>n=3</code></p>

<pre><code>aaa baa ... zaa
aba aca ... aza
aab aac ... aaz
abb abc ... abz
acb acc ... acz
...
azz bzz ... zzz  
</code></pre>