Getting passed, but no output?


This is getting approved, but I have no output. It's not printing what I'm intending it to print, but I'm still getting passed. For example, I'm just getting "None" in the output viewer.

def reverse(text):
    new = ""
    for char in range(len(text)-1,-1,-1):
        new = new + text[char]
    return new
    print new   


to print what a function returns, you should add print in front of the function call


Thank you for your response. Is there a way to put print inside the function, though? So I can just call the function without print?


yea of course, but you have to realize that a function ends the moment a return keyword is reached

so the print statement you currently placed inside your function won't be reached, given return will end the function


Ah, I see. I just reversed the order of return and print and it worked. Thanks!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.