Python Practice › List Programs › Program 81
Count vowels in a list of words
Write a Python program to count the vowels in a list of words.
Input
["Learning", "Python", "From", "SqaTool"]
Output
8
Approach
- Join and count characters in “aeiou”.
Solution
words = ["Learning", "Python", "From", "SqaTool"]print(sum(ch in "aeiouAEIOU" for w in words for ch in w))Output
8
Note
The words contain 3 + 1 + 1 + 3 = 8 vowels.
Learn the concept
New to this topic? Read the lesson, then come back.