Question: Assignment Write a recursive palindrome function to complete the following program. The palindrome function must be recursive. You may not use any while or for

 Assignment Write a recursive palindrome function to complete the following program.The palindrome function must be recursive. You may not use any whileor for loops or list comprehensions. You may use multiple base and

Assignment Write a recursive palindrome function to complete the following program. The palindrome function must be recursive. You may not use any while or for loops or list comprehensions. You may use multiple base and multiple recursive cases to determine if the text is a palindrome. Base cases should return True or False when you determine if the text is or is not a palindrome. Recursive cases should skip spaces and punctuation or compare the remaining string when the end characters match. All comparisons in the function should be case sensitive, Anna is not a palindrome, but anna is a palindrome. The program should provide a text? prompt. After the user enters a line of text, the program should print Palindrome if the text is a palindrome and Emordnilap otherwise. NOTE you can check if a character is alphanumeric with "char isalnum if you want to check a character in a string 's" at position i is alphanumeric, you can use slil, isalnum salnumO returns a Boolean True of character is alphanumeric, else False Sample Input and Output text? Able was I, ere I saw Elba. Emo ranil ap text? able was I, ere I saw elba. Palindrome text? Able was I Emordnilap main.py 3 def palindrome(s): 4 "Returns True if the string parameter contains a palindrome, False otherwise.""" pass 6 7 9 def main) 10 """DO NOT CHANGE THIS CODE""" 11 text = input( 'text? ') 12 if palindrome(text): 13 14 else: 15 16 17 if_namemain_" 18 main) 19 print("Palindrome" print("Emordnilap") # not a palindrome

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!