Python Program to Count the Number of Each Vowel Using a list and a dictionary comprehension


Topic: Python Program to Count the Number of Each Vowel Using a list and a dictionary comprehension

Solution

ip_str = 'Hello, have you tried our tutorial section yet?'
ip_str = ip_str.casefold()
count = {x:sum([1 for char in ip_str if char == x]) for x in 'aeiou'}
print(count)



List all Python Programs