Python: Reversing the order of words in a string and in place

Question: Say we want to write a function in Python that takes a string and reverses the order of the words in place. How would you do it?

Answer: In python, C# and Java (and many other languages) strings are immutable so this is not possible to do. But let’s say we use the list representation of the string and want to reverse the order of words in place. The following is the shortest code that I can come up with.