Random word generator python
<p>So this is the code I have. The outcome is something along "['jjjjjjj', 'tt', 'dddd', 'eeeeeeeee']". How can I change the list comprehension to allow for the function random.choice to repeat for each letter of each 'word'?</p>

<pre><code>lista=[random.randint(1,10)*random.choice(string.ascii_letters) for i in range(random.randint(1,10))]
</code></pre>

<p>I suppose you mean you want "abcd" and "jdhn" instead of "aaaa" and "jjjj" for the purpose of testing a sorting algorithm or some such.</p>

<p>If so, try this</p>

<pre><code>lista=["".join(random.choice(string.ascii_letters) for j in range(random.randint(1,10)) ) for i in range(random.randint(1,10)) ]
</code></pre>

python