What is palindrome string?
A string is a palindrome if the string read from left to right is equal to the string read from right to left i.e. if the actual string is equal to the reversed string.
In the below program, we are implementing a python program to check whether a string is a palindrome or not?
Steps:
- First, find the reverse string
- Compare whether revers string is equal to the actual string
- If both are the same, then the string is a palindrome, otherwise, the string is not a palindrome.
Example:
Input:
"Google"
Output:
"Google" is not a palindrome string
Input:
"RADAR"
Output:
"RADAR" is a palindrome string
Method 1: Manual
Output
Method 2: Slicing
Output
need an explanation for this answer? contact us directly to get an explanation for this answer