Error: reverse("Python!") fails --> returns "!nohtyP" not "!nohtyP"


#1

https://www.codecademy.com/courses/python-intermediate-en-rCQKw/1/1?curriculum_id=4f89dab3d788890003000096#

This is the error message:
Oops, try again. Your function fails on reverse(“Python!”). It returns " !nohtyP" when it should return “!nohtyP”.

The error message appears to tell me that the function DOES work while also claiming it does not work. Am I hallucinating? I’ve already tried refreshing the page, clearing browser cache and starting again, what am I missing here? Thanks!

```python

def reverse(text):
a = " "
i = len(text)
while i:
i-=1
a += text[i]
return a

reverse(“Python!”).


#2

see the space between " and !? Its the cause of the problem:

"_!nohtyP"

i replaced the space with a underscore so you can see it.

The problem seems to be a isn’t an empty string when you define it


#3

Thank you so much! I knew it had to be something tiny like that that I just wasn’t seeing! It’s like in other languages when someone is sure he has all his semi-colons but then a fresh set of eyes spots a missing one. Thanks.


#4