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 trialMesrop Janoyan
10,165 PointsWhy doesn't my code work on Treehouse Challenges, but works as intended in my terminal running python3?
I ran the code "return [thing[::-1] for thing in things]" in my terminal and it returned what I expected. Meanwhile, I get "Bummer! reverse didn't accept an argument" when I use the same code in Treehouse.
backwards = [
'tac',
'esuoheerT',
'htenneK',
[5, 4, 3, 2, 1],
]
def reverse(things):
return [thing[::-1] for thing in things]
1 Answer
Chris Freeman
Treehouse Moderator 68,441 PointsYou are doing more than the challenge requests. It only wish to reverse the iterable passed as a parameter, not reverse each element in the iterable. This is sufficient for Task 1:
backwards = [
'tac',
'esuoheerT',
'htenneK',
[5, 4, 3, 2, 1],
]
def reverse(things):
return things[::-1]
Mesrop Janoyan
10,165 PointsMesrop Janoyan
10,165 PointsYepp, that definitely fixed it. Thank you for such a quick reply!