def scrub(word): return word.strip().lower() def contains(word, char_list): selected_chars = find_all_in(char_list, word) return char_list in selected_chars def find_all_in(desired_chars, word): result = '' for char in word: if char in desired_chars: result += char return result word_source = open ('dictionary.txt', 'r') for word in word_source: word = scrub(word) if len(word) < 5: continue if contains(word, 'aeiou'): print(word)