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.
Sample Input 1
No lemon no melon
Sample Output 1
True
Sample Input 2
Race Cars
Sample Output 2
False
string = input().replace(',', '').replace(' ', '').lower()
for i, letter in enumerate(string, start=1):
if letter != string[-i]:
print('False')
exit()
print('True')
Comments
Leave a comment