# This was my first attempt after the simplest solution. # It has the right idea -- start looking at the next word, # and stop looking sooner than the end. But it looks at # all words that start with the same letter! Our goal is # words that start with the entire root word. def puzzle_a(word_list): count = len(word_list) for i in range(count): j = i + 1 while j < count and word_list[j][0] == word_list[i][0]: if word_list[j] == (word_list[i] + 'er'): break j += 1 else: continue k = j + 1 while k < count and word_list[k][0] == word_list[i][0]: if word_list[k] == (word_list[i] + 'est'): break k += 1 else: continue print(word_list[i], word_list[j], word_list[k])