a=input('enter a string :')# palindrome in string
b=a[::-1]
if a==b:
print(a,'is a palindrome')
else:
print(a,'is not a palindrome')
print('a is not equal to b')
if a!=b:
print(b, 'the reverse of', a)
#output:
--------------------------------------------------------------------------------
case-I
# not palindrome
enter a string :1254
1254 is not a palindrome
a is not equal to b
4521 the reverse of 1254
--------------------------------------------------------------------------------
case-II
# palindrme
enter a string :12321
12321 is a palindrome
def ispalindrome(word):
return word == word[::-1]
def ispalindrome(word):
if len(word) < 2: return True
if word[0] != word[-1]: return False
return ispalindrome(word[1:-1])