Six Letters
A solution to Conflicting Objectives kata described at CodeKata.
Solution
""" six_letters.py """
# usage: python3 six_letters.py
with open('words', 'r', encoding='utf-8') as text_input:
words = text_input.read().split()
n = 6
n_letter_words = [word for word in words if len(word) == n]
smaller_words = [word for word in words if len(word) in range(2, n - 1)]
for word in n_letter_words:
for i in range(2, n - 1):
x, y = word[:i], word[i:]
if x in smaller_words and y in smaller_words:
print(f'{x} + {y} => {word}')