Solution Review: Remove Sublist From List

This lesson gives a detailed review of how to remove a sublist from a list.

Solution 1: Use the remove() Function

The solution is fairly simple; use the remove function to delete the elements of the sublist l2 from l1.

Therefore, Python’s inbuilt functions make things much more convenient since you don’t have to worry about any extraneous implementation level details like you would have to with other languages. Given below is an illustration of how the provided solution would play out.

Get hands-on with 1200+ tech skills courses.