Saturday, March 24, 2018

List remove( ) Method


List remove( ) Method

        Removes object obj from list

Syntax :

remove ( obj )

Parameters
        obj - This is the object to be removed from the list.
Return Value
This method does not return any value but removes the given object from the list.

Example
#!/usr/bin/python3

list1 = ['physics', 'Biology', 'chemistry', 'maths']
list1.remove('Biology')
print ("list now : ", list1)
list1.remove('maths')
print ("list now : ", list1)
  When we run the above program, it produces the following result –

list now : ['physics', 'chemistry', 'maths']
list now : ['physics', 'chemistry']



<<< pop( )                           Go to Index                       reverse( ) >>>