# File: palindrome.py def isPalindrome(s): # empty string and single character always palindromic if len(s) <= 1: return True # if first and last char differ, not if s[0] != s[-1]: return False # check middle portion return isPalindrome( s[1:-1] ) def main(): iString = input("Enter a string: ") if isPalindrome(iString): print("Yes,", iString, "is a palindrome!") else: print("No,", iString, "is not a palindrome!") main()