Skip to content

Instantly share code, notes, and snippets.

@akshaynagpal
Created December 10, 2014 12:50
Show Gist options
  • Save akshaynagpal/274f443239fa8009ee67 to your computer and use it in GitHub Desktop.
Save akshaynagpal/274f443239fa8009ee67 to your computer and use it in GitHub Desktop.
Reverse a string in python without using reversed() or [::-1]
def reverse(test):
n = len(test)
x=""
for i in range(n-1,-1,-1):
x += test[i]
return x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment