Reverse: Getting list into string variable



I'm having trouble with the "Reverse" exercise. I have successfully created a list with all of the letters in reverse order, but I'm having trouble getting that list back into a string variable. Here is my code:

def reverse(text):
    text = list(text)
    txet = []
    i = int(len(text)) - 1
    while i > -1:
        i = i - 1
    txet = str(txet)
    return ''.join(txet)
print reverse('Python!')

I'm getting back 'Python!' as a list containing ['!', 'n', 'o', 'h', 't', 'y', 'P'], which is pretty cool. But "return ''.join(txet)" is not giving me back the list joined as a string like I am expecting. Does anyone have any suggestions?


I have also tried storing the result of ''.join(txet) in a new variable and printing that, but that is producing the same result. I have tried the same process in the Python 3.5 shell and it seems to work there:

a = ['a', 'b', 'c']

But pasting my code into IDLE and running it (after updating for syntax changes for Python 3.5) produces the same result I'm getting here in the Codecademy interpreter.


you where so close with your original solution, all you had to do was remove this line:

txet = str(txet)

this line cast your list into a string, but it still looks like a list, but because it is a string join is no longer working


Thank you so much, that did it!