Write a program in python to check whether a string is a palindrome string or not.

Example:

To check palindrome string we need to follow the following steps.

  1. Input a String (str).
  2. Reverse the string (rev).
  3. Check if str == rev.
  4. If YES then the string is palindrome else not.

Before reversing the string we have to be sure that all the letters in the given string are in the same case (lowercase or uppercase) because if not then Mom would result into ‘Not Palindrome’.

Therefore we will first use inbuilt lower() to convert the string into the lowercase, then we will reverse the string and will compare it with the original string to check if its palindrome or not.

Let’s see the python source code.

Output 1

Output 2

If you have any suggestions or doubts then please comment below. Also, do like our FB page for interesting stuff.

Leave a Reply