Answer to Question #220250 in Python for chandi

Question #220250

You are given a string, write a program to find whether the string is palindrome or not.

Note: Treat uppercase letters and lowercase letters as same when comparing letters. Ignore spaces and quotes within the string.


Input

The first line of input is a string.

Output

The output should be

True or False.Explanation

In the given example, the string

No lemon no melon is a palindrome as we are ignoring spaces. So, the output should be True.


Was it a cat I saw? so the output should be False


1
Expert's answer
2021-07-24T07:05:27-0400
source = input()
letters = ''
for ch in source:
    if ch != '"' and ch.isspace() == False:
        letters += ch.lower()
reversed=letters[::-1]
print(letters == reversed)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS