Python Program to Check if a String is Palindrome or Not.

In this tutorial we are going to learn how to check whether a given string is Palindrome or not Palindrome using Python Code.

Palindrome is defined as A palindrome is a word, number, phrase, or other sequence of symbols that reads the same backward as forwards, such as madam,121.

def check_palindrome(word):
    return word == word[::-1]
word = "madam"
if check_palindrome(word):
    print("word is a palindrome")
else:
    print("word is not a palindrome")

OUTPUT:

 

Leave a Reply

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