Reverse string problem

def reverse(text):
  for i in range(len(text)):
    print text[(len(text)-1)-i],

i wrote this program to reverse the string. As you can see i have given “Python!” as input.
but when i try to run the program it shows the output :-

! n o h t y Pc b a ! n o h t y P

when i give “Hello” as input it shows this as output: -

o l l e Hc b a ! n o h t y P

first of all there is my “Hello” reverse and then reverse of “abc” and then reverse of “Python!”

whatever input i give it shows output as my input reverse + reverse of abc + reverse of Python!.

is it a bug or am i doing something really stupid


Codecademy calls your function to test it.

Your function isn’t supposed to print anything


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.