Challenge 3: Check for a Palindrome

Given a string, check whether or not it is a palindrome.

Problem Statement

Write a function that takes a variable testVariable, which contains a string, and checks whether or not it is a palindrome.

What is a “Palindrome”?

A Palindrome is a string that reads the same backward and forwards. For example madammadam, poppop, etc. All strings with length 11 are considered palindromes.

Remember, lower case letters are different from upper case letters, therefore, AdaAda is not a palindrome.

Input

A variable testVariable containing a string.

Output

True if the input string is a palindrome. False if the string is not a palindrome.

Sample Input

"madam"

Sample Output

True

Try it Yourself

Try this challenge yourself before examining the solution. Good luck!

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.