Created
December 2, 2015 09:53
-
-
Save riyadhalnur/fdb4aa68cee1d8784109 to your computer and use it in GitHub Desktop.
Reverse a string in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def reverse(text): | |
reversed = [] | |
for i in range(len(text)): | |
reversed.append(text[-(i+1)]) | |
return ''.join(reversed) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment