Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
what to do exactly?
is the output supposed to be empty, or a list with an empty list? Not sure about bracketing in your task: a) Use .remove() and/or del to remove [the string, boolean, and list] members of the_list or b) Use .remove() and/or del to remove the string, boolean, and [list members] of the_list ??? Thank you!
Chris FreemanTreehouse Moderator 68,064 Points
In each task, the goal is to operate on
the_list to modify it according to the instructions. There are many operations that operate on a list "in place" which means changing
the_list without reassigning to another variable. Your code will be a series of statement affecting
the_list. List methods to use are:
.pop()removes the last item from a list,
.pop(index)removes the item from a list at that index
- `.insert(index, item) inserts an item into list at position index
- `.remove(item) removes the first occurrence of that item from list
- `.extend(list) extends a list with the members from another list
the_list = ["a", 2, 3, 1, False, [1, 2, 3]] # Remove the '1' from the list the_list.pop(3) # Insert the '1' into the first position the_list.insert(0, 1) # or in one step the_list.insert(0, the_list.pop(3))
You solution will be a series of these list altering statements. Post back if you need more hints.