Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Reverse an string Using Recursion in Python

def reverse(s):
if len(s) == 0:
return s
else:
return reverse(s[1:]) + s[0]
s = "SoftHunt"
print ("The original string is : ",end="")
print (s)
print ("The reversed string(using recursion) is : ",end="")
print (reverse(s))
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Reverse #string #Using #Recursion #Python
ADD COMMENT
Topic
Name
6+8 =