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

Python Python Collections (Retired) Slices Sorting Slices

Been stuck on for days, can someone just give me the answer so I can move on? Please!

Just what the title says

4 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,441 Points
# Task 1: copy using [:] syntax
clean_list = messy_list[:]
# Task 2: sort using sort() method
clean_list.sort()
# Task 3:Now, create a variable named silly_list that is every third item,
# backwards, from messy_list.
silly_list = messy_list[::-3]

Which part pas giving you the trouble?

Vittorio Somaschini
Vittorio Somaschini
33,371 Points

Hello Holden,

in which task are you stuck? This code challenge is divided in 3 parts..

Vitto

The 3rd challenge. THANK YOU SO MUCH!!!! I just kept trying to use the clean list. Can you all fix that so it will say to use the messy list or something so it will hopefully not trip up others as much as it did for me?

Chris Freeman
Chris Freeman
Treehouse Moderator 68,441 Points

On my first pass, I had the same error of trying to operate on clean_list instead of messy_list!

Task 3: Now, create a variable named silly_list that is every third item, backwards, from messy_list. For example, the first two items in silly_list should be [-1, 8].`

That Feeling When... you reread the instructions and it dawns on you that you misread it the first time and the answer is now obvious. :grin:

It happens to all programmers from time to time and it's a good lesson to read instructions carefully. Since the question is unambiguous it good as is.

Oh wow... hahahaha. Fail. It always seems to be something so simlle and right in front of you doesn't it? Thanks! The best part of Treehouse, a great community that very nice and helpful.