Write a program vowel_counter.py
that prints out how many vowels there are in a word entered by the user.
The program should include a function count_vowels(word)
that takes the parameter word
and goes through it letter by letter, and comparing those with the vowels stored in a list: ['a', 'e', 'i', 'o', or 'u']. That function returns the vowel count to the main program which prints it out.
As long as you are counting values, count the number of y
letters in the word as well. If a word has no standard vowels, indicate the number of y
letters in the word.
Note that this doesn't always yield the correct number of vowel sounds in a word. The word "why" has a single vowel in it, the y
, and the word "yellow" has two vowels, e
and o
--the strategy given above yields a correct count for those words.
The word "mystery", however, has three vowels it in: the e
and the two y
s. The simple "aeiou" or "y" counter fails for a word like this.
Modify count_vowels(word)
so that it also works for words like "mystery". What is the distinguishing characteristic about the first "y" in "mystery" that would indicate it should be counted as a vowel?