human
Sum of all odd length palindromic numbers within the range [ L , R ] | Function that returns true if the given number is a palindrome.
Here we are generating a new number ( reverse_num ) by reversing the digits of original input number.
If the original input number ( num ) is equal to its reverse ( reverse_num ) then its palindrome else it is not ..
Function that returns true if the given number is of odd length.
Function to return the sum of all odd length palindromic numbers within the given range.
if number is palindrome and of odd length.
Driver code"
Solution in Python:
 ... Write me a code to sum of all odd length palindromic numbers within the range [ L , R ] and the other steps required?
assistant
#Here is code to sum of all odd length palindromic numbers within the range [ L , R ] and the other steps required.
 def isPalindrome ( num ) :
	reverse_num = 0
	temp = num
	while ( temp != 0 ) :
		remainder = temp % 10
		reverse_num = reverse_num * 10 + remainder
		temp = int ( temp / 10 )
	if ( reverse_num == num ) :
		return True
	return False
def isOddLength ( num ) :
	count = 0
	while ( num > 0 ) :
		num = int ( num / 10 )
		count += 1
	if ( count % 2 != 0 ) :
		return True
	return False
def sumOfAllPalindrome ( L , R ) :
	sum = 0
	if ( L <= R ) :
		for i in range ( L , R + 1 , 1 ) :
			if ( isPalindrome ( i ) and isOddLength ( i ) ) :
				sum += i
	return sum
if __name__ == ' _ _ main _ _ ' :
	L = 110
	R = 1130
	print ( sumOfAllPalindrome ( L , R ) )