human
Write me a code to minimum number of Appends needed to make a string palindrome and the other steps required given the following:
Minimum number of Appends needed to make a string palindrome | Checking if the String is palindrome or not.
single character is always palindrome.
pointing to first character.
pointing to last character.
Recursive function to count number of appends.
Removing first character of String by incrementing base address pointer ..
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to minimum number of Appends needed to make a string palindrome and the other steps required.
 def isPalindrome ( Str ) :
	Len = len ( Str )
	if ( Len == 1 ) :
		return True
	ptr1 = 0
	ptr2 = Len - 1
	while ( ptr2 > ptr1 ) :
		if ( Str [ ptr1 ] != Str [ ptr2 ] ) :
			return False
		ptr1 += 1
		ptr2 -= 1
	return True
def noOfAppends ( s ) :
	if ( isPalindrome ( s ) ) :
		return 0
	del s [ 0 ]
	return 1 + noOfAppends ( s )
se = " abede "
s = [ i for i in se ]
print ( noOfAppends ( s ) )