└── count the number of each vowel /count the number of each vowel: -------------------------------------------------------------------------------- 1 | # Program to count the number of each vowels 2 | 3 | # string of vowels 4 | vowels = 'aeiou' 5 | 6 | ip_str = 'Hello, have you tried our tutorial section yet?' 7 | 8 | # make it suitable for caseless comparisions 9 | ip_str = ip_str.casefold() 10 | 11 | # make a dictionary with each vowel a key and value 0 12 | count = {}.fromkeys(vowels,0) 13 | 14 | # count the vowels 15 | for char in ip_str: 16 | if char in count: 17 | count[char] += 1 18 | 19 | print(count) 20 | --------------------------------------------------------------------------------