Solution: Getting Started
Let's look at the solution to the previous exercise.
We'll cover the following...
Exercise 1
Press + to interact
def vowelCount(word):vowel = ['a','e','i','o','u']count = 0word = word.lower()for x in vowel:count = count + word.count(x)return countprint(vowelCount('Gilles De Rais'))
Explanation
Line 2: We define the
vowel
list, which contains the vowels in the English alphabet.Line 3: The word is converted into lowercase using the
lower()
method.Line 4: The
count
variable is set to 0. ...