Palindrome String using Recursion (Easy method)
def palindrome(s,n,r):
if n==0:
return r
else:
r+=s[n-1]
return palindrome(s,n-1,r)
s="malayalam"
n=len(s)
r=''
res=palindrome(s,n,r)
if s==res:
print(res,"is palindrome string")
else:
print(res,"is not palindrome string")
Comments
Post a Comment
If you have any doubt you ask me in comment section