Ram is asked to code the logic to find if a given sentence or a word is a palindrome or not. Help him to code this logic in Python. Remember to do a case insensitive check.
Refer the sample input and output statements for more clarifications.

Sample Input1:
Enter the word : Malayalam
Sample Output1:
Yes, the string is a palindrome !

Sample Input2:
Enter the word : Python
Sample Output2:
No, the string is not a palindrome !

Sample Input3:
Enter the word : Was it a rat I saw
Sample Output3:
Yes, the string is a palindrome !

Code :-

word=input("Enter the word : ")
new_word=word.lower().replace(" ","")
if new_word[::1]==new_word[::-1]:
    print("Yes, the string is a palindrome !")
    print("No, the string is not a palindrome !")

2 thoughts on “Palindrome”

  1. Nice post. I learn one thing more challenging on totally different blogs everyday. It is going to always be stimulating to read content material from other writers and apply slightly something from their store. I抎 prefer to make use of some with the content on my blog whether you don抰 mind. Natually I抣l give you a link in your web blog. Thanks for sharing.

Leave a Comment

Your email address will not be published. Required fields are marked *