Write a program to input a number or word from the user and find its reverse. If the reverse is the same as the input then it is a palindrome. Check if the text is a palindrome or not.
x = input("Enter the string : ")
y = x[::-1]
# printing reverse string
print("Reverse of the string: ",y)
# checking whether palindrome or not
if y == x:
print("String is palindromic")
else:
print("String is not palindromic")
Comments
Leave a comment