human
Sentence Palindrome ( Palindrome after removing spaces , dots , . . etc ) | To check sentence is palindrome or not.
Lowercase string.
Compares character until they are equal.
If there is another symbol in left of sentence.
If there is another symbol in right of sentence.
If characters are equal.
If characters are not equal then sentence is not palindrome.
Returns true if sentence is palindrome.
Driver program to test sentencePalindrome ( )"
How can the above be solved in Python?
assistant
#Here is code to sentence Palindrome ( Palindrome after removing spaces , dots , .
 def sentencePalindrome ( s ) :
	l , h = 0 , len ( s ) - 1
	s = s . lower ( )
	while ( l <= h ) :
		if ( not ( s [ l ] >= ' a ' and s [ l ] <= ' z ' ) ) :
			l += 1
		elif ( not ( s [ h ] >= ' a ' and s [ h ] <= ' z ' ) ) :
			h -= 1
		elif ( s [ l ] == s [ h ] ) :
			l += 1
			h -= 1
		else :
			return False
	return True
s = " Too ▁ hot ▁ to ▁ hoot . "
if ( sentencePalindrome ( s ) ) :
	print " Sentence ▁ is ▁ palindrome . "
else :
	print " Sentence ▁ is ▁ not ▁ palindrome . "