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 First Slice

Quiz: slices

a_list = [1, 2, 3] a_list = ??? Task: Copy the entire list with a slice.

Maybe I do not understand the question but why is a_list[::] or a_list[0:2:1] or a_list[0::1] incorrect?

2 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,428 Points

You are correct!! a_list[::] and a_list[0::1] should be acceptable. The other acceptible answer should be a_list[0:3:1]. Using 2 instead of 3 results in [1, 2].

Tagging Craig Dennis to note quiz First Slice needs updating.

Chris Freeman
Chris Freeman
Treehouse Moderator 68,428 Points

Sorry. I thought you had passed the quiz and were giving alternative answer issues. Use a_list[:]

Then what would be the correct answer to pass the quiz? I have failed with all these answers :-(