Created
May 27, 2016 22:27
-
-
Save KHerb/6bb127379f6f3ee123baa7e90dada0c5 to your computer and use it in GitHub Desktop.
Returns reverse order of string input
This file contains hidden or 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
x = str(raw_input("Type a sentence and I will reverse the order of it! ")) | |
def reverse(x): | |
x = x.split(" ") | |
for i in x: | |
f = x[::-1] | |
f = " ".join(f) | |
return f | |
print reverse(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment