Python Programming

Write a function reverse_words() that takes a message as a list of characters and reverses the order of the words in-place. Why a list of characters instead of a string? The goal of this homewrok is to practice manipulating strings in place. Since we’re modifying the message, we need a mutable type like a list, instead of Python‘s immutable strings.

YOU ARE NOT ALLOWED TO USE THE reverse method; that means, you have to use one or more loops to reverse the list.

For example: message = [ ‘c’, ‘a’, ‘k’, ‘e’, ‘ ‘, ‘p’, ‘o’, ‘u’, ‘n’, ‘d’, ‘ ‘, ‘s’, ‘t’, ‘e’, ‘a’, ‘l’ ]

# Prints: 'steal pound cake'_x000D_
print ''.join(message)

When writing your function, assume the message contains only letters and spaces,
and all words are separated by one space.