Reversing a String with Recursion | Data Structures & Algorithms | Python

preview_player
Показать описание
Recursion in Python Functions | Python Language Tutorial

or call us at +91-9347815104

-~-~~-~~~-~~-~-
Please watch: "LRU Cache (With Python Code) "
-~-~~-~~~-~~-~-
Рекомендации по теме
Комментарии
Автор

def reverse_string(word):
if len(word) == 0:
return word
return


kvelez
Автор

You could've used head recursion instead. Your solution creates new strings as you slice.

sasidharnaidu
Автор

Nice explanation. However, this just prints the reverse of the string, it doesn’t return the reverse.

thermalmedia
Автор

Can anyone tell, how every time last character is split out recursively?

Aryansingh-fkhy
welcome to shbcf.ru