[Reverse] Alternative approach works in CA but I'm getting Syntax errors elsewhere



This validates correctly on Codecademy, but won't run on another IDE (repl.it). Is there something wrong with this?

Also I took a different approach than most of the other solutions. Is mine less efficient? Is there anything that is not pythonic?
Maybe my solution will help someone else.

def reverse(text):
    r = len(text)  #find the length of text
    newtext = ''   #sets up as string
    while r > 0:
        newtext = newtext+text[r-1]
        r -= 1
    return newtext
print reverse('Python!')


By the way, I get SyntaxError: invalid syntax (, line 9). I get this in repl.it and pythontutor .


in python3, print is update from a keyword to a function call, so you need parentheses:



Oh my gosh, I should have known. Thanks so much!