Reverse The Given String Using Recursion | Python Programs | Interview Question And Answer

Published: 31 January 2021
on channel: Amulya's Academy
29,484
725

In this Python programming video series we will learn how to reverse the given string using recursion.

Program 01:
def reverse_str(str1):
if str1 == "":
return ""
else:
return reverse_str(str1[1:]) + str1[0]

str1 = input("enter the string:")
str2 = reverse_str(str1)
print("reversed string is :",str2)


Program 02:
def reverse_str(str1):
if len(str1)==1:
return str1
else:
return reverse_str(str1[1:]) + str1[0]

str1 = input("enter the string:")
str2 = reverse_str(str1)
print("reversed string is :",str2)

Star Pattern With Recursion:
   • Python Pattern Programs - Printing Stars '...  

Recursion:
   • Python Programming Tutorial - Recursive Fu...  

#PythonPrograms #PythonProgramming

For more free tutorials on computer programming
  / amulsacademy  
  / amulsacademy  


On this page of the site you can watch the video online Reverse The Given String Using Recursion | Python Programs | Interview Question And Answer with a duration of hours minute second in good quality, which was uploaded by the user Amulya's Academy 31 January 2021, share the link with friends and acquaintances, this video has already been watched 29,484 times on youtube and it was liked by 725 viewers. Enjoy your viewing!