7. reverse help


#1



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


https://www.codecademy.com/courses/python-intermediate-en-rCQKw/1/1?curriculum_id=4f89dab3d788890003000096#

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.


#2

everything is properly formatted


#4

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:


#5

Ahh thank you! That makes much more sense now!


#7