I am trying to write a function that takes a string and reverses the words in that string, and then returns the string. I have written this code but when I execute it nothing happens. A blank appears.
def reverse(tex):
new_w = " "
for i in range(0, len(tex)):
new_w += text[len(tex) - 1 - i]
return new_w