Created
May 5, 2017 06:21
-
-
Save lon-io/a4ec5c075197c2249ea31f100ee1f27e to your computer and use it in GitHub Desktop.
Python script to reverse a given string
This file contains 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
# Reverse a given string | |
def reverse(str): | |
l = [] | |
for index, i in enumerate(str): | |
j = len(str)-1 - index | |
l.append(str[j]) | |
return ''.join(l) | |
print reverse("asdaad") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment