Reverse()


#1



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


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

Can anyone help?


def reverse(text):
    res = []
    s = ""
    count = len(text) - 1
    while count > -1:
        res.append(text[count])
        count -= 1
    "".join(res)
    return res


#2

Have you given any thought to what's different about those two values and what actions you'd need to carry out to go from one to the other? (describe what's stopping you from continuing)


#3

I appreciate, the response, but I figured it out. I was return res, not the result of using .join on res. I figured it out!


#4

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