I am doing the codecademy tutorial and I got stuck during a lesson where I have to reverse a word. My function works when I test it myself, but when the program checks it by calling reverse("Python!") it returns "cba!nohtyP". That is not the case when I call it the same way. Then it returns correctly "!nohtyp". Can anyone please help me what is the issue with my code?
The message errors are: There are none, just the program does not believe that it is working
Oops, try again. Your function fails on reverse("Python!"). It returns "cba!nohtyP" when it should return "!nohtyP".
reversed_list =  def reverse(text): length = len(text) - 1 while length >= 0: reversed_list.append(text[length]) length -= 1 result = "" for i in reversed_list: result += i return result