https://raw.githubusercontent.com/dwyl/english-words/master/words_alpha.txt
from itertools import permutations
from collections import Counter
with open("words_alpha.txt") as f: # Download this list or use your own
wordlist = set(f.read().split())
letters = "adefhimnorstuwy"
letter_count = Counter(letters)
def is_valid(word):
return not (Counter(word) - letter_count)
valid_words = sorted([word for word in wordlist if is_valid(word)])
valid_words_by_length = {length: [] for length in range(2, 16)}
for word in valid_words:
if 2 <= len(word) <= 15:
valid_words_by_length[len(word)].append(word)
print(valid_words_by_length[5])
#or whatever length you want by changing the number