7. Reverse, console not working?


So, I know my code works because i called it at the end with a string but it always says
"Oops, try again. Your function fails on reverse("Python!"). It returns "None" when it should return "!nohtyP"." but when i call the function it works fine so why is it not working???

def reverse(text):
    txt = []
    revlen = 0
    for l in str(text):
        revlen += 1
    for n in range(revlen):
        print txt[revlen-1],
        revlen -= 1


You are printing the value in reverse to the console rather than returning it.

What print does is provide output to the console. What return does is provide the given value to the location that invoked its function.


I see, so it was a stupid mistake XD