Question: Your task is to write a routine: find _ palindrome ( pattern ) which takes a tuple and returns a tuple or None. The returned
Your task is to write a routine: findpalindromepattern which takes a tuple and returns a tuple or None.
The returned tuple must be a palindrome which results from removing just one element from pattern. So for instance, if pattern was the returned tuple would be If more than one element must be removed from the tuple to make a palindrome, or a palindrome is not possible, then findpalindrome returns None.
A few special cases:
No trivial single element palindromes. The returned palindrome must be of length or longer. If pattern is too short to result in a palindrome of length or pattern is None, return None.
No throwing exceptions they confuse zybooks If there are other bad input conditions not discussed here, return None.
No modifying elements in pattern. So if pattern is abaa do not return aaa
No moving elements within pattern. The only permissible change to get a new pattern is to remove one element.
pattern may already be a palindrome, in which case you need to see if a there is a way to remove one element and get a new palindrome.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
