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>You'll need a nested list comorehension. You need to rerun random.choice for every letter. Something along the lines of</p>

<pre><code>[ [Random.choice(string.asciiletters) for x in range(y)]  for you in range(5)]
</code></pre>

<p>Will give you 5 'words' each of length y.</p>

python