Tom 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 Input 1: Enter the word : Madam
Sample Output 1: Yes, the string is a palindrome !
Sample Input 2: Enter the word : Python
Sample Output 2: No, the string is not a palindrome !
Sample Input 3: Enter the word : Was it a rat I saw
Sample Output 3: Yes, the string is a palindrome !
I've coded as follows:
t1 = input('Enter the word : ').lower()
if( t1==t1[::-1])
print('Yes, the string is a palindrome !')
else:
print('No, the string is not a palindrome !')
Still I am not able to pass all test cases. Can anyone please help me to figure it out?