human
Write me a code to length of longest palindromic sub and the other steps required given the following:
Length of longest palindromic sub | Function to find maximum of the two variables.
Function to find the longest palindromic substring : Recursion.
Base condition when the start index is greater than end index.
Base condition when both the start and end index are equal.
Condition when corner characters are equal in the string.
Recursive call to find the longest Palindromic string by excluding the corner characters.
Recursive call to find the longest Palindromic string by including one corner character at a time.
Function to find the longest palindromic sub - string.
Utility function call.
Driver Code.
Function Call"
How can the above be solved in Python?
assistant
#Here is code to length of longest palindromic sub and the other steps required.
 def maxi ( x , y ) :
	if x > y :
		return x
	else :
		return y
def longestPalindromic ( strn , i , j , count ) :
	if i > j :
		return count
	if i == j :
		return ( count + 1 )
	if strn [ i ] == strn [ j ] :
		count = longestPalindromic ( strn , i + 1 , j - 1 , count + 2 )
		return maxi ( count , maxi ( longestPalindromic ( strn , i + 1 , j , 0 ) , longestPalindromic ( strn , i , j - 1 , 0 ) ) )
	return maxi ( longestPalindromic ( strn , i + 1 , j , 0 ) , longestPalindromic ( strn , i , j - 1 , 0 ) )
def longest_palindromic_substr ( strn ) :
	k = len ( strn ) - 1
	return longestPalindromic ( strn , 0 , k , 0 )
strn = " aaaabbaa "
print ( longest_palindromic_substr ( strn ) )