human
Write me a code to count palindrome words in a sentence and the other steps required given the following:
Count palindrome words in a sentence | Function to check if a word is palindrome.
Function to count palindrome words.
splitting each word as spaces as delimiter and storing it into a list.
Iterating every element from list and checking if it is a palindrome ..
if the word is a palindrome increment the count ..
Driver code"
Solution in Python:
assistant
#Here is code to count palindrome words in a sentence and the other steps required.
 def checkPalin ( word ) :
	if word . lower ( ) == word . lower ( ) [ : : - 1 ] :
		return True
def countPalin ( str ) :
	count = 0
	listOfWords = str . split ( " ▁ " )
	for elements in listOfWords :
		if ( checkPalin ( elements ) ) :
			count += 1
	print ( count )
countPalin ( " Madam ▁ Arora ▁ teaches ▁ malayalam " )
countPalin ( " Nitin ▁ speaks ▁ malayalam " )