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!
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
The question asked - Copy the entire list with a slice a_list = [1, 2, 3] a_list ______ what is the answer
The question asked - Copy the entire list with a slice a_list = [1, 2, 3] a_list ______ what is the answer?
I don't understand the question...
In Python, to make a copy of a list using slices, you have to slice from the very start to the very end. You can manually enter the indexes of the start and the finish, but it is easier to use Python's
>>> my_list = [1, 2, 3] >>> my_list[0:3] # This makes a copy! [1, 2, 3] >>> my_list[:] # This also makes a copy! [1, 2, 3]
I hope this helps! ~Alex
Vlad Vamos1,290 Points
I think you need to select the whole list with the slicing method. Slicing example:
a_list = [1, 2, 3] print(a_list[1:3]) -> [2, 3]
Thanks all :)