Skip to content

Instantly share code, notes, and snippets.

@ZoeyYoung
Created June 5, 2013 15:37
Show Gist options
  • Save ZoeyYoung/5714852 to your computer and use it in GitHub Desktop.
Save ZoeyYoung/5714852 to your computer and use it in GitHub Desktop.
Reverse String
s = 'abcdefgh'
r = s[::-1]
print(r) #a : hgfedcba
def reverse(word):
if word == '':
return word;
return reverse(word[1:]) + word[0]
print(reverse('abcdefg'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment