(s, i)
| 1 | '''A recursive Python program to check whether a string is palindrome or not''' |
| 2 | |
| 3 | def isPalindrome(s, i): |
| 4 | if(i > len(s)/2): #base case |
| 5 | return True |
| 6 | ans = False |
| 7 | if((s[i] is s[len(s) - i - 1]) and isPalindrome(s, i + 1)): #recursive step |
| 8 | ans = True |
| 9 | return ans |
| 10 | |
| 11 | str = "racecar" |
| 12 | if (isPalindrome(str, 0)): |