Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Functional Python Functional Workhorses Map

Andy McDonald
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Andy McDonald
Python Development Techdegree Graduate 13,801 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'.