Exercise · Strings · lesson 9 of 10
Exercise: vowels
Write a function count_vowels(text) that returns how many Latin vowels a, e, i, o and u the string text contains. Uppercase vowels count too.
count_vowels("Hello")→2count_vowels("AEIOU aeiou")→10count_vowels("rhythm")→0
Constraints: text consists of Latin letters, digits, spaces and punctuation and may be an empty string; the letter y is not a vowel.
Do not add extra imports unless the task says so explicitly.
Subscribe to take the course
The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.