We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 4bd9377 + da848dc commit a306666Copy full SHA for a306666
Recursion/is_Palindrome.py
@@ -0,0 +1,16 @@
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)):
13
+ print("Yes")
14
+else:
15
+ print("No")
16
0 commit comments