Reverse


#1



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

it shows that rev is still empty


def reverse(text):
    rev=""
    count=0
    for i in range(len(text),0):
        rev[count]=text[i]
        count=count+1
    return rev


#2

if you want to take negative steps, you have to tell as much to the range function:

range(len(text),0,-1)

#3

You are trying to manipulate a string as you would a list.

Either change rev to an empty list, or use += to add the text on. :slight_smile:


#4

then what is the method to traverse through a string character by character


#5

You would use indices, but your string is empty, and doesn't have indices.