human
Count of substrings consisting of even number of vowels | Utility function to check if a character is a vowel.
Function to calculate and return the count of substrings with even number of vowels.
Stores the count of substrings.
If the current character is a vowel.
Increase count.
If substring contains even number of vowels.
Increase the answer.
Prthe final answer.
Driver Code"
How can the above be solved in Python?
 ... Can you provide a code to count of substrings consisting of even number of vowels and the other steps required?
assistant
#Here is code to count of substrings consisting of even number of vowels and the other steps required.
 def isVowel ( c ) :
	if ( c == ' a ' or c == ' e ' or c == ' i ' or c == ' o ' or c == ' u ' ) :
		return True
	return False
def countSubstrings ( s , n ) :
	result = 0
	for i in range ( n ) :
		count = 0
		for j in range ( i , n ) :
			if ( isVowel ( s [ j ] ) ) :
				count += 1
			if ( count % 2 == 0 ) :
				result += 1
	print ( result )
if __name__ == ' _ _ main _ _ ' :
	n = 5
	s = " abcde "
	countSubstrings ( s , n )