Question: Write a recursive function called quasi _ palindrome in a file called quasipal.py which will test for quasi - palindromes ( as described below )

Write a recursive function called quasi_palindrome in a file called quasipal.py which will test for quasi-palindromes (as described below).
A palindrome is a word spelled the same forwards and backwards, for instance "racecar" or "tacocat" which of course is a real word.
Most sequences of letters like abcdefg are not palindromes. Let's introduce a nearby concept where we talk about a quasi-palindrome.
A quasi-palindrome of type 1 is a word where it would be a palindrome if we could change one letter for instance: abcdba would be the palindrome abccba or abddba if we could change either one of those letters. However it is not a palindrome itself.
A quasi-palindrome of type 2 is a word where it is 2 away from being a palindrome. For instance abczxa is 2 away from being a palindrome.
Write a function called:
def quasi_palindrome(word, errors):
Where word is a string and errors is the maximum number of errors allowed. Determine if a word is a quasi-palindrome (of type -N) where N is the number of errors allowed. Your function should return True or False.
[Hint: Try to think of using slices to go from one level of the string to another.]

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!