# Alex Grattan
# 17/10/14
message = input("Enter your message to have it printed backwards:")
split_message = list(message.split())
reverse_message_list = []
reverse_message = ""
for i in range(len(split_message)):
reverse_message_list.append(split_message.pop())
reverse_message_list = [x + ' ' for x in reverse_message_list]
for i in reverse_message_list:
reverse_message += i
print (reverse_message)
|
||||
|
So this can then be compressed to
|
|||||||||||||
|
Why even go the route of
the output would then be:
EDIT: Per @ferada's comment, this reverses the sentence by words, not letters:
and the output:
Also, do be mindful of the |
|||||||||
|