These exercises are challenging and satisfying when you get them. But, this one is stumping me. When I've looked at previous posts on this lesson, all the posts have significantly more lines than I do. I hope I'm not missing that much, because I believe that i = len(text) - i is doing what I need to perfectly. I just need a bit of help here.
Oops, try again. Does your reverse function take exactly one argument (a string)? Your code threw a "unsupported operand type(s) for -: 'int' and 'str'" error.
The console says "None" and when I tell it to print reverse("Python!") it reads:
Traceback (most recent call last):
File "python", line 6, in
File "python", line 4, in reverse
TypeError: unsupported operand type(s) for -: 'int' and 'str'
def reverse(text): new_string = str(text) for i in new_string: i = len(text) - i return new_string