human
Can you provide a code to longest Subsequence of a String containing only vowels and the other steps required given the following:
Longest Subsequence of a String containing only vowels | Function to check whether a character is vowel or not.
Returns true if x is vowel.
Function to find the longest subsequence which contain all vowels.
Length of the string.
Iterating through the string.
Checking if the character is a vowel or not.
If it is a vowel , then add it to the final string.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to longest Subsequence of a String containing only vowels and the other steps required.
 def isVowel ( x ) :
	return ( x == ' a ' or x == ' e ' or x == ' i ' or x == ' o ' or x == ' u ' )
def longestVowelSubsequence ( str ) :
	answer = " "
	n = len ( str )
	for i in range ( n ) :
		if ( isVowel ( str [ i ] ) ) :
			answer += str [ i ]
	return answer
str = " geeksforgeeks "
print ( longestVowelSubsequence ( str ) )