Palindrome – Python Lab Program

This is to check whether the given string is a palindrome or not.

s=input("Enter the String")
l=len(s)
i=int(l-1)
s=s.lower()
for a in s:
    if(s[i]==a):
        flag=1
        i=i-1
    else:
        flag=0
         i=i-1

if(flag==1):
    print("The Given String is Palindrom")
else:
    print("The Given String is Not Palindrom")

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.