Question: Part I ( Warmup Problems ) Problem 4 ( Palindrome ) Implement the function _ isPalindrome ( ) in palindrome.py , using recursion, such that

Part I (Warmup Problems) Problem 4(Palindrome)
Implement the function _isPalindrome() in palindrome.py, using recursion, such that it returns True if the argument s is a palindrome (ie, reads the same forwards and backwards), and False otherwise
~/workspace/atomic nature of matter
$ python3 palindrome.py bolton False
$ python3 palindrome.py madam True
Part I (Warmup Problems) Problem 4(Palindrome)
Set n to the length of s
Base case: if n =0, return True
Recursive step: return True if the first character in s is the same as the last character and isPalindrome(s[1 : n 1]) is True; otherwise, return False
python code

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 Programming Questions!