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
David HernandezPython Development Techdegree Graduate 12,180 Points
unable to create a function that reverses
I keep getting an error that says reverse didn't accept an argument, however, if I run it locally it works just fine.
from copy import copy backwards = [ 'tac', 'esuoheerT', 'htenneK', [5, 4, 3, 2, 1], ] def reverse(items): items = copy(items) return [item[::-1] for item in items]
Jeff MudayTreehouse Moderator 28,372 Points
I can see from your code you understood how to reverse an array. Good job!
It is a little simpler than you expected.
def reverse(items) return items[::-1]
Now, for the second part of the Challenge, you are going to use
reverse as a reference to the function in Part 1. And
map() to assign a new variable
forwards = map(reverse, backwards)
The wording is a little bit awkward, but you get the gist of it!