Skip to content

Commit

Permalink
Create reverse
Browse files Browse the repository at this point in the history
if i have time,more on reversed() function , or [::-1]
so much to learn
自律给我自由
Self-discipline set me free.
  • Loading branch information
zfk513 authored Aug 16, 2017
1 parent f64bb1a commit 7a26c46
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions reverse
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

def reverse(text):
if len(text) <= 1:
return text

return reverse(text[1:]) + text[0]
print reverse('abcd')

0 comments on commit 7a26c46

Please sign in to comment.