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!

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

14,136 Points

Some items not working with map challenge

I can't pass the challenge as it seems some items aren't working unfortunately for some reason?

backwards = [
    [5, 4, 3, 2, 1],

def reverse(iter):
    return sorted(iter, reverse=True)

forwards = map(reverse, backwards)

1 Answer

Chris Freeman
Chris Freeman
Treehouse Moderator 68,390 Points

Using sorted will create a list from a string, sort it, then reverse it. So strings don't remain strings, and the order is changed before reversing order.

A simpler reversal is to use slice notation [::-1]

Using sorted should not have passed the challenge. A note has been sent to Kenneth Love to improve the challenge checker for Task 1. Thanks for catching this bug! :grin: