top of page

PALINDROME STRING PROGRAM

This is a program for palindrome strings


CODE :

a = input("Enter a String-")
l = len(a)
p = l - 1
index = 0
while index < p :
    if ( a[index] == a[p] ) :
        index = index + 1
        p = p - 1
    else :
        print("string is not a palindrome")
        break
else :
    print("String is a palindrome")

OUTPUT :

ree

Comments


bottom of page