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 trialRakshith Nayak
1,893 Pointsdoes the remove method remove only one argument?
Here in this video they had a list [1, 2, 3, 4, 5, [6, 7, 8,]] where they were able to remove [6, 7, 8] from the list. But isn't that considered to be more than one argument? or is the list inside of a list considered to be just one argument? Also, for instance, what if I had a list [1,2,3] and I wanted to remove all of them at once using the remove method to end up with an empty list. Would that be possible?
Any input would be much appreciated thank you
3 Answers
Chris Freeman
Treehouse Moderator 68,441 PointsHere in this video they had a list [1, 2, 3, 4, 5, [6, 7, 8,]] where they were able to remove [6, 7, 8] from the list. But isn't that considered to be more than one argument?
remove
is looking to match a single object. In this case, the single object is a list that happens to contain multiple items.
or is the list inside of a list considered to be just one argument?
Correct.
Also, for instance, what if I had a list [1,2,3] and I wanted to remove all of them at once using the remove method to end up with an empty list. Would that be possible?
As this list contains three items, each item would need to be removed in a separate remove
statements. Although, if you truly are removing all the elements then setting the list to the empty list would work: = []
G Johnson
46,427 PointsThe list inside of a list is considered to be one element.
Rakshith Nayak
1,893 PointsThat cleared my doubts. Thank you guys