7. reverse


#1



def reverse(text):    
text = str(text)
    word_len = len(text)
    if word_len > 0:
        return text[word_len]
        word_len -= 1
return text

def reverse(text):
    text = str(text)
    for i in range(len(text), 0):
        return i
    return text

These do not work - please help!



#2

what type of help you need ??
correct code !
to correct your code ( so we need the output error) !
you don't understand what the function do !
...


#3

your first function is wrongly indented, indent is important in python, since it determines the nesting.

Secondly, as soon as a function reaches a return keyword, something gets returned, and the function ends!! So you might want to rethink how you use return, if you need more help, post an updated version of your code and what you are struggling with


#4

5 posts were split to a new topic: Reverse