interview questions

Check whether a string is palindrome


Previously, we have seen how to find whether a number a palindrome or not in C++ (palindrome code in C++). In this article, we will see whether you can find a string(containing chars, numbers or special characters) and check whether it is a palindrome or not. We have shared python code to check palindrome sequence too.

What is Palindrome?

palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward. For example: Mom, 1221

Some more examples of palindrome are: Never odd or even, A man, a plan, a canal – Panama, Borrow or rob,A nut for a jar of tuna

Now, we will the implementation of code to check whether a string is palindrome or not in python.



def checkPalindrome(var):
		return "Invalid Entry"

	listVar = list(var.strip())
	isPalindrome = "Palindrome found"
			isPalindrome="No Palindrome"

	return isPalindrome


End note

In this article, we have showed you how to write a code to find palindrome in a string in Python. If you have any confusion regarding the code, please do comment in discussion thread below or send us email to 

You can use our code in your website. Kindly do acknowledge us by linking our website or this page. 

About Xamnation

If you are interested, you can reach us at for more details. 


Leave a Comment

Your email address will not be published. Required fields are marked *