educative.io

Educative

Error - list.remove(x) no longer works, needs to be updated with list.pop(x)

Hi there,

In lesson “Common List Operations” in the Data Structures - Learn Python 3 From Scratch course, the method list.remove(x) no longer works. remove() only works for a listed element, not an index. The method should be list.pop(x), which will remove the element at the specified index.

Cheers,

david

Hi @David_Alexander,
Yes, you are right. We can not use list.remove(index_of_an_element) for deleting an element, but in our course, we didn’t mention anything about it. We have mentioned that you can use list.remove(element_to_be_deleted) to delete an element, which is working perfectly fine.
Happy learning :slightly_smiling_face: