Program to count vowels in a string ( Iterative and Recursive ) | Function to check the Vowel ; to count total number of vowel from 0 to n ; string object ; Total numbers of Vowel
def isVowel ( ch ) : NEW_LINE INDENT return ch . upper ( ) in [ ' A ' , ' E ' , ' I ' , ' O ' , ' U ' ] NEW_LINE DEDENT def countVovels ( str , n ) : NEW_LINE INDENT if ( n == 1 ) : NEW_LINE INDENT return isVowel ( str [ n - 1 ] ) ; NEW_LINE DEDENT return ( countVovels ( str , n - 1 ) + isVowel ( str [ n - 1 ] ) ) ; NEW_LINE DEDENT str = " abc ▁ de " ; NEW_LINE print ( countVovels ( str , len ( str ) ) ) NEW_LINE