Skip to content

Instantly share code, notes, and snippets.

@lon-io
Created May 5, 2017 06:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lon-io/a4ec5c075197c2249ea31f100ee1f27e to your computer and use it in GitHub Desktop.
Save lon-io/a4ec5c075197c2249ea31f100ee1f27e to your computer and use it in GitHub Desktop.
Python script to reverse a given string
# 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