Question: Write a recursive function (palindromeRec) that takes a string (str), and returns True or False, depending on whether or not str is a palindrome. Note:
Write a recursive function (palindromeRec) that takes a string (str), and returns True or False, depending on whether or not str is a palindrome. Note: The sample code below does not need to be copied into your answer. You are responsible for the function described above, and nothing else. Note: A palindrome is a word that is spelled the same backwards and forwards, such as eve or ablewasiereisawelba Hint: To check if a string is a palindrome, you could check the first and last characters. If they are not equal, the string is not a palindrome. If they are, the string is a palindrome if the remaining characters between the first and last character are also a palindrome. For example, within the palindrome level is the palindrome eve. Function name Description range(x, y, z) Returns a list of numbers between x and y (not including y), spaced apart by z. Example: range(0, 7, 2) => [0,2,4,6] len(s) Returns the number of elements in the string s. Example: len([0,2,4,6]) => 4 Permitted Functions for this question Sample Output: print("is level a palindrone?",palindromeRec("level")) # True print("is lever a palindrone?",palindromeRec("lever")) # False
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
