def load_words(filename, length):
    """
    Returns a list of all words contained in filename that have the given length.
    """
    words_needed = []
    with open(filename) as file:
        all_words = [L.rstrip('\n') for L in file]
        for word in all_words:
            if len(word) == length:
                words_needed.append(word)
    return words_needed