How To Generate A Random Word With Python

Lets return a random word of N length with Python

Yet again Reddit got the better of me again and I ended up helping a random stranger on their programming travels. Enjoy!

# wget

import random

def have_a_word(l):
    with open('words_alpha.txt') as f:
        all_words =
        return random.choice([i for i in all_words if len(i) == l])

word = have_a_word(3)

Thanks for reading. x