def count_vowels(text):
vowels = "aeiouAEIOU" #fix vowels
count = 0 #hold given string vovel counting
for char in text: #interat the given text by charecter
if char in vowels: #test the current charecter is in univershal vowel list
count += 1 #if found then incresee the count value
return count #at return the count value
print('Vovels - ', count_vowels("Python Programming"))
Output:
Vovels - 4
Explanation:
Loop through each character in the string.
If the character is in the set of vowels, increase the count.
"Python Programming" → vowels are o, o, a, i → total 4.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Output:
Explanation:
"Python Programming"→ vowels areo, o, a, i→ total 4.Read More: