Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Functional Python Functional Workhorses Map

Andy McDonald
Andy McDonald
5,016 Points

Quiz not allowing me to pass

Doesn't make sense... my code works in workspaces but it doesn't work for the quiz. Says its not being reversed correctly and doesn't give me any hints as to how the correct way to reverse it is. I tried sorted(arg, reverse=True) but of course that doesn't work because of the list within the list. Idk what to do.

maps.py
backwards = [
    'tac',
    'esuoheerT',
    'htenneK',
    [5, 4, 3, 2, 1],
]

def reverse(arg):
    newlist = []
    count = len(arg)
    for i in reversed(range(0, count)):
        newlist.append(arg[i])
    return newlist

1 Answer

Megan Amendola
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree seal-36
Megan Amendola
Treehouse Teacher

Hi! You should be returning a reversed version of the thing passed in not a list with the thing reversed. For example, the first is the string 'tac' and you are returning ['c', 'a', 't'] instead of 'cat'.