"""=========================== ==
exercise 9.5
=============================" ""
def uses_all (word, use_all_chars):
for char in use_all_chars:
if char.lower() not in word.lower():
if char != " ": #ignore space character
return False
return True
#print uses_all("Ho ho ho","acefhlo")
#print uses_all("Flo ace hoe","acefhlo")
fin = open('words.txt')
use_all_vowels = "aeiou"
use_all_vowels_and_y = "aeiouy"
for line in fin:
word = line.strip()
if uses_all(word,use_all_vowels):
print word
vowels = vowels + 1
if uses_all(word,use_all_vowels_ and_y):
print word
vowels_and_y = vowels_and_y + 1
total_words = total_words + 1
print "number of words with aeiou = ",vowels
print "number of words with aeiouy = ",vowels_and_y
This comment has been removed by the author.
ReplyDeletetotal_words = 0
ReplyDeletevowels = 0
vowels_and_y = 0