Skip to content

Instantly share code, notes, and snippets.

@thcipriani
Created May 31, 2011 19:47
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 thcipriani/1001133 to your computer and use it in GitHub Desktop.
Save thcipriani/1001133 to your computer and use it in GitHub Desktop.
Reverse string iteration
k = 'Tardis'
i = 0
for letter in k:
i -= 1
print k[i]
# This will also work - extended slice method to reverse string:
# k = 'words'
# k = k[::-1]
# for letter in k:
# print letter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment