Reverse String using Recursion (Python Code)

preview_player
Показать описание
In this video how to reverse a string using recursion is discussed.
Рекомендации по теме
Комментарии
Автор

Thanks ! It's helpful to me. I was searching reverse code lot in website, but just got in my mind to visit YouTube lessons. I just clicked ur channel and I got the coding at the first attempt and your explanation is awesome. Thank you. 😃

niviedhashekor
Автор

Good Evening Sir.
please cn u help me with this.
*Write a recursive function to print a string backwards.
1. # simple recursion
2. def bp (sg, n) :
3. if n > 0:
4. k = len (sg) - n
5. bp( sh, n -1)
6. print (sg[k], end = ' '
7. elif n == 0 :
8. return
9.
10. #_main_
11. s = input ("Enter a string: ")
12. bp(s, len (s))

vloggerkk