Created
March 3, 2014 03:07
-
-
Save uttamg911/9317783 to your computer and use it in GitHub Desktop.
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
# This is a comment in Python | |
import sys #imports system files | |
for line in sys.stdin: | |
line = line.strip() # Strips a string of its trailing white spaces # Tabs tell python that it is part of the loop | |
word = line.split(' ') # Makes a list of substrings by using space as as delimiter | |
s = ' '.join(word[::-1]) # [::-1] reverses the contents of a list # The syntax for join is counter intuitive, first you write the delimiter and then the list. | |
print s # Prints the string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment