human
Reverse vowels in a given string | utility function to check for vowel.
Function to reverse order of vowels.
Start two indexes from two corners and move toward each other.
swapping.
Driver function"
How can the above be solved in Python?
assistant
#Here is code to reverse vowels in a given string and the other steps required.
 def isVowel ( c ) :
	return ( c == ' a ' or c == ' A ' or c == ' e ' or c == ' E ' or c == ' i ' or c == ' I ' or c == ' o ' or c == ' O ' or c == ' u ' or c == ' U ' )
def reverseVowel ( str ) :
	i = 0
	j = len ( str ) - 1
	while ( i < j ) :
		if not isVowel ( str [ i ] ) :
			i += 1
			continue
		if ( not isVowel ( str [ j ] ) ) :
			j -= 1
			continue
		str [ i ] , str [ j ] = str [ j ] , str [ i ]
		i += 1
		j -= 1
	return str
if __name__ == " _ _ main _ _ " :
	str = " hello ▁ world "
	print ( * reverseVowel ( list ( str ) ) , sep = " " )