Skip to content

Instantly share code, notes, and snippets.

@I82Much
Created January 13, 2011 05:10
Show Gist options
  • Save I82Much/777436 to your computer and use it in GitHub Desktop.
Save I82Much/777436 to your computer and use it in GitHub Desktop.
$ python reverse.py I like dogs
dogs like I
import sys
def reverseSentence(sentence):
reversed = sentence.split()[::-1]
return " ".join(reversed)
def main():
sentence = " ".join(sys.argv[1:])
print reverseSentence(sentence)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment