What is the Recursion Function?
A Recursion is a function that calls itself during its execution.
So, how to reverse a string using recursion?
String Recursion will take place with the help of len() function and slicing of string.
len() returns the length of a string
For better understanding do have a look on below pictures
def rev(s): if len(s) == 0:
return rev(s[1:]) + s
n= str(input("Enter the string to be reversed: "))
Enter the string to be reversed: cppsecrets