Program to count vowels in a string ( Iterative and Recursive ) | Function to check the Vowel ; Returns count of vowels in str ; Check for vowel ; string object ; Total number of Vowels
def isVowel ( ch ) : NEW_LINE INDENT return ch . upper ( ) in [ ' A ' , ' E ' , ' I ' , ' O ' , ' U ' ] NEW_LINE DEDENT def countVowels ( str ) : NEW_LINE INDENT count = 0 NEW_LINE for i in range ( len ( str ) ) : NEW_LINE INDENT if isVowel ( str [ i ] ) : NEW_LINE INDENT count += 1 NEW_LINE DEDENT DEDENT return count NEW_LINE DEDENT str = ' abc ▁ de ' NEW_LINE print ( countVowels ( str ) ) NEW_LINE