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 Introduction To Slices

quiz question-posed as copy a_list = [1,2,3] to new list

I would expect the answer to be

a_list2 = a_list[:] to make a copy of the a_list

but can't enter that a_list = a_list[:] would also make a new list in the same place, but that won't accept either

2 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,423 Points

The question is not looking for an equation, rather it is only looking for the syntax of a copied string:

Fill in the blank below:</br>

a_list = [1, 2, 3]

a_list*[:]*

Copy the entire list with a slice.

I agree with Alex. I wanted to enter "a_list2 = a_list[:]" also. You get a "copy" of the output to the screen when you just use "a_list[:]", but the question (and the topic of the second half of the lesson) seems to imply that we copy it into a new variable.

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

Same for me when I originally took the quiz. Maybe time for feedback Kenneth Love: maybe the question can be reworded. Thanks!

Rafael Valera
Rafael Valera
8,401 Points

It's kind of confusing actually when it says "copy"... I even thought making a new variable "a_list_new" and then the entire list with a slace like this a_list_new = a_list[:]