Challenge 3: Check Palindrome
Given a string, check whether it is a palindrome or not.
We'll cover the following
Problem Statement
Write a function that takes a variable testVariable
containing a string, and checks whether it is a palindrome or not.
What is a “Palindrome”?
A Palindrome is a string that reads the same backward and forwards.
For example , , etc. Also, all strings with length are palindromes.
Remember, lower case letters are different from upper case letters, therefore, is not a palindrome.
Input
A variable testVariable
containing a string.
Output
True
, if the input string is a palindrome or False
, if the string is not a palindrome.
Sample Input
"madam"
Sample Output
True
Try it Yourself
Try to attempt this challenge by yourself before moving on to the solution. Good luck!
def isPalindrome(testVariable) :# Write your code herereturn None
Let’s have a look at the solution review of this problem.