Palindrome - 3
You are given a string, write a program to find whether the string is palindrome or not.
The first line of input is a string.
The output should be
In the given example, the string
No lemon no melon is a palindrome as we are ignoring spaces. So, the output should be True.
text = input().lower().replace(' ', '').replace('"', '').replace("'", '')
print(text[:len(text) // 2] == text[-1:-len(text) // 2 - 1:-1])
Comments
Leave a comment