Python OOPs


Python SQLite


Examples


Others


Count each vowel in given string using Python


Write a Python program to count each vowel in given string.

#count each vowels 
vowels=('a','e','i','o','u')
count=dict.fromkeys(vowels,0)
for x in 'letter':
    if x in vowels:
        count[x]+=1
print(count)
Output:
{'a': 0, 'e': 2, 'i': 0, 'o': 0, 'u': 0}