Skip to content

Instantly share code, notes, and snippets.

@tadone
Created November 7, 2017 08:52
Show Gist options
  • Save tadone/a8f0e94f3238eb1c075983accf172208 to your computer and use it in GitHub Desktop.
Save tadone/a8f0e94f3238eb1c075983accf172208 to your computer and use it in GitHub Desktop.
[Reverse String] Reverse given string using string slicing
# This is extended slice syntax. It works by doing [begin:end:step] - by leaving begin and end off and specifying a step of -1, it reverses a string.
>>> 'hello world'[::-1]
'dlrow olleh'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment