Skip to main content

To Check whether a string is a Palindrome or not using python program

Palindrome


wrd=input("Please enter a word : ")
wrd=str(wrd)
rvs=wrd[::-1]
print(rvs)
if wrd == rvs:
print("This word is a palindrome")
else:
print("This word is not a palindrome")


Output:
Please enter a word : hannah
hannah

This word is a palindrome

Comments