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 trialashleyknowlesswingle
508 PointsNeed help with reversing a list.
Trying to solve the problem to create a function named reverse and return a reversed list. I continually get the response "Bummer! Try again!" This message doesn't help in any way.
backwards = [
'tac',
'esuoheerT',
'htenneK',
[5, 4, 3, 2, 1],
]
def reverse(iterable_item):
print(list(map(reverse_iterable_item)))
#return a reversed version of the iterable_item
1 Answer
Cory Madden
7,120 PointsYou're not actually reversing the item in this function. To reverse a list you want to "slice" it by adding [::-1] to the end.
def reverse(item):
return item[::-1]