Remove () is a method which is used delete an object from list in python. It does not return any value. If there are multiple element/object of same value it will delete first occurance of that element / object from the list.
remove() in Python:
In Python, we can remove elements from data structures like list, tuple, dictionary and sets using remove function.
Example :
list=[ 1 , 2, 4 , 5 , 6]
list.remove( 2 )
list=[ 1, 4 , 5 , 6]
Syntax :
list_name.remove( obj )
obj – element to be deleted.
Returns Nothing , but remove the element from the list.
Login/Signup to comment