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 (2016, retired 2019) Slices Back and Forth

please help im lost here

how do i sort my sorted things list

favorite_things = ['raindrops on roses', 'whiskers on kittens', 'bright copper kettles',
                   'warm woolen mittens', 'bright paper packages tied up with string',
                   'cream colored ponies', 'crisp apple strudels']
slice1 = ['whiskers on kittens', 'bright copper kettles', 'warm woolen mittens']
slice2 = ['cream colored ponies', 'crisp apple strudels']
sorted_things = ['raindrops on roses', 'whiskers on kittens', 'bright copper kettles',
                 'warm woolen mittens', 'bright papper packeges tied with string',
                'warm colored ponies', 'crisp apple strudels']

2 Answers

Challenge 1: You need to start from index 1(second item) until index 4(not included)

slice1 = favorite_things[1:4]

Challenge 2: (Last 2 element)

slice2 = favorite_things[-2:]

Challenge 3: First copy the old one to sorted_things, then use the sort() method

sorted_things = favorite_things[:]

so I'm stuck on Challenge 2. I tried what you said here after I tried doing [5:7] but its still says that task 1 is no longer passing. Any Ideas?

It's being picky and doesn't like that you manually created a copy of favorite_things instead of doing it programmatically. If you use the slice method of copying new_list = old_list[:] to create your sorted_things that way, you'll be good.