という名前のリストに保存されているテキスト ファイルが与えられますwords_list
。
if __name__ = "__main__":
words_file = open('words.txt')
words_list = []
for w in words_file:
w = w.strip().strip('\n')
words_list.append(w)
文字列のリストは次のようになります (非常に長い単語のリストです)。
すべての母音を含む「すべての単語」を見つけなければなりません。これまでのところ、私は持っています:
def all_vowel(words_list):
count = 0
for w in words_list:
if all_five_vowels(w): # this function just returns true
count = count + 1
if count == 0
print '<None found>'
else
print count
これに関する問題count
は、母音を見るたびに 1 を追加することですが、単語全体にすべての母音が含まれている場合にのみ1 を追加したいのです。