Is it possible to turn this program I have written into a single recursion function that ignores case differences, white spaces, and non-English letters? For example, the program must be able to return "True" to the following string, ignoring the uppercase "R" and the period."Rats live on no evil star.". No imports, only one function and the only the method that can be used is isalpha().
def main() :
inputStr = input("Enter a string: ")
if isPalindrome(inputStr) :
print("That's a palindrome.")
else:
print("That isn't a palindrome.")
def isPalindrome(string) :
if len(string) <= 1 :
return True
if string[0].lower() == string[len(string) - 1].lower() :
return isPalindrome(string[1:len(string) - 1])
else :
return False
main()