Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Recursion/is_Palindrome.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'''A recursive Python program to check whether a string is palindrome or not'''

def isPalindrome(s, i):
if(i > len(s)/2): #base case
return True
ans = False
if((s[i] is s[len(s) - i - 1]) and isPalindrome(s, i + 1)): #recursive step
ans = True
return ans

str = "racecar"
if (isPalindrome(str, 0)):
print("Yes")
else:
print("No")