15.Practice Makes Perfect


#1



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


Oops, try again. Your function fails on reverse("Python!"). It returns "['!', 'n', 'o', 'h', 't', 'y', 'P']" when it should return "!nohtyP".


!nohtyP


def reverse(text):
    j=len(text)
    rev=[]
    while j>0:
        rev.append(text[j-1])
        j=j-1
    return rev

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


#2

you return a list, you should return a string

.join() can be used to join a list into a string


#3

Can you show me how to use .join() in this program?


#4

for this we have tutorials, if you don't know you can also use another for loop and concat the string with +


#5

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