Skip to content

Instantly share code, notes, and snippets.

@uttamg911
Last active August 29, 2015 13:56
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 uttamg911/9124985 to your computer and use it in GitHub Desktop.
Save uttamg911/9124985 to your computer and use it in GitHub Desktop.
This python program reverses the words of a sentence
import sys #imports system files
for line in sys.stdin:
line = line.strip() # Tabs tell python that it is part of the loop
word = line.split(' ')
s = ''
for i in range(1,len(word)+1):
s = s + word[len(word)-i] + ' '
print s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment