Created
January 13, 2011 05:29
-
-
Save roopeshvaddepally/777451 to your computer and use it in GitHub Desktop.
Reverse the words in a sentence seperated by spaces
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
a = "put in the required sentence" | |
# reverse splice the sentence split by space, then join with space | |
" ".join(a.split(" ")[::-1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment