frequency of each vowel

Solutions on MaxInterview for frequency of each vowel by the best coders in the world

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