Reverse text code


#1

Why is this code not working ?

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

the code below works in python3

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

isn't "," the python2 way to print in one line ?


#2

both print the reversed string, but neither returns the reversed string. The exercise wants you to return the reversed string


#3

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