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
Herman Brummer
6,414 PointsFirst Slice not working [Solved]
testing_list = [1, 2, 3, 4, 5]
def reverse_evens(iterable4):
list = iterable4[::2]
list = sorted(list)
return list[::-1]
print (reverse_evens(testing_list)) # EXPECTING 5,3,1 and it works!
The code runs correctly, but the system does not accept this method ?
2 Answers
Herman Brummer
6,414 PointsWorks once I took out
list = sorted(list)
Chris Freeman
Treehouse Moderator 68,468 PointsMoved to answer to mark as best answer.
Jon Mirow
9,864 PointsGlad to hear it's working, just a reminder that list is a reserved word in python for the list class, so best to avoid using for variable names; I tend to use lst or something_list :)
Chris Freeman
Treehouse Moderator 68,468 PointsMoved comment to answer to upvote.
Chris Freeman
Treehouse Moderator 68,468 PointsChris Freeman
Treehouse Moderator 68,468 PointsMarked as "Solved"