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 trialJovan Dandridge
12,835 PointsManipulating List 3 of 3 not working... or is there something wrong?
im not able to get this to work and I did everything the video says
the_list = ["a", 2, 3, 1, False, [1, 2, 3]]
# Your code goes below here
list = the_list
list.pop(3)
list.insert(0, 1)
list.remove("a")
list.remove(False)
list.remove([1, 2, 3])
list.extend(range(4, 21))
2 Answers
Chris Freeman
Treehouse Moderator 68,441 PointsThe challenge is looking for the variable the_list
. Your code manipulates a list
instead. Rename all your statements to use the_list
.
Jovan Dandridge
12,835 PointsThanks Chris Freeman it works.
Chris Freeman
Treehouse Moderator 68,441 PointsChris Freeman
Treehouse Moderator 68,441 PointsJovan, technically your code produces the correct answer. The grader is not smart enough to know it.
When you copied the list using
list = the_list
, you are actually only copying the reference to the list. An item can be identified by its "id". In the code below, you can see thatlist
andthe_list
have the same id and the same value at the end of the code:Results: