Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
https://repl.it/C7E0/0 created by charles2588
#Recursive way of string reverse
def reversestring(str):
return str[len(str)-1::-1]
def recursivereversestr(str):
if len(str)<1:
return str
else:
return recursivereversestr(str[1:])+str[0]
print(reversestring("ADCA"))
print(recursivereversestr("charles"))
Python 3.5.1 (default, Dec 2015, 13:05:11)
[GCC 4.8.2] on linux
>>> ACDA
selrahc
=> None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.