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

Found Solution to Challenge Not Accepted

When I run my maps.py code in the Python interpreter, I get all individual items in the "backwards" list properly reversed. When I try solutions using map and the reverse function, the result above is never produced. Since this exercise expects a certain solution, I do need help writing the one being asked for. Thank you!

maps.py
from copy import copy

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

def reverse(iter_item):
   return [item[::-1] for item in iter_item]

1 Answer

Steven Parker
Steven Parker
229,982 Points

It sounds like you may have the two tasks confused. In task 1, you'll make the simple "reverse" function. If created with a slice, it won't need a loop, generator, or comprehension.

Now, in task 2, you will use "map" to apply that function to a list. But you won't alter the task 1 function itself.