7. reverse help


def reverse(text):
    text = str(text)
    n = len(text) - 1
    word = ""
    while n >= 0:
        letter = text[n]
        n -= 1


Oops, try again. Your code looks a bit off--it threw a "'str' object has no attribute 'append'" error. Check the Hint if you need help!

I don't quite understand why this form wouldn't work. I expect it to loop through my code indexing from last to first character, but apparrently not

Replace this line with your code.


everything is properly formatted


The problem is that strings in python don't have a .append method. It is used with lists. All you need is a simple word = word + letter :slight_smile:


Ahh thank you! That makes much more sense now!