Last active
August 29, 2015 13:56
-
-
Save uttamg911/9124985 to your computer and use it in GitHub Desktop.
This python program reverses the words of a sentence
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
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