Count the vowels
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version.
Count the vowels
Count how many characters of a string are vowels — a, e, i, o, u — treating capitals and lowercase the same.
Lowercase the string first with s.lower() so you only have five letters to check. The expression ch in "aeiou" is True when ch is one of them.
Write count_vowels(s): return how many letters in s are vowels (a, e, i, o, u), case-insensitive.
Click Run to see the output here.