Skip to main content

Palindrome Checker Using Python

 

Problem:

            To find whether a given input is a palindrome or not. We use two methods to find the palindrome, one is using "reverse indexing" and "reverse function".

Palindrome: The term palindrome means, consider a string and reverse it then compare both the                                 string if they are equal then it is a palindrome.

Code:

def palindrome(a):

    if a == a[::-1]:
        print("It is a Palindrome")

    else:
        print("It is not a Palindrome")

val = input("Enter the value")

palindrome(val)



Comments