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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Lionel Victor](https://uploads.teamtreehouse.com/production/profile-photos/2672322/micro_Chelan.jpeg)
Lionel Victor
2,490 PointsHow to remove more than one value from a list ?
Is there a different method to remove more than one item from a list
If you try doing that for example : mylist.remove(4,5)
It returns Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: remove() takes exactly one argument (2 given)
Is there a different solution to this ?
2 Answers
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 Points
You probably want to use slice.
For example, to remove elements 4 and 5:
mylist = mylist[:4] + mylist[6:]
Or to remove the last 10 elements from a list:
mylist = mylist[:-10]
![Kourosh Raeen](https://uploads.teamtreehouse.com/production/profile-photos/3971082/micro_TreehouseProfilePic.jpg)
Kourosh Raeen
23,733 PointsHi Lionel - If you want to remove contiguous indexes you can try this:
mylist[4:6] = []
If the indexes are not contiguous you can try something like this:
mylist = [i for j, i in enumerate(mylist) if j not in [0, 6, 8]]
which removes the items at indexes 0, 6, and 8.