...

/

Solution: Getting Started

Solution: Getting Started

Let's look at the solution to the previous exercise.

Exercise 1

Press + to interact
def vowelCount(word):
vowel = ['a','e','i','o','u']
count = 0
word = word.lower()
for x in vowel:
count = count + word.count(x)
return count
print(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. ...