Answer to Question #231605 in Python for kaavya

Question #231605

Palindrome - 2

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.Input

The first line of input is a string.

Output

The output should be the string

True or False.Explanation

In the given example, the string

Madam is a palindrome as we are treating M and m as equal. So, the output should be True.

Sample Input 1

Madam

Sample Output 1

True

Sample Input 2

Treat

Sample Output 2

False




1
Expert's answer
2021-08-31T05:58:55-0400
word = ''
for ch in input():
    word += ch.lower()
reversed_word = word[::-1]
print(word == reversed_word)

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