The remove() method removes the first occurrence of the given element in the list.
Example
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
list1 = ['MIT', 'CIT', 'Yale','UCI']
list1.remove('CIT')
print("the list1 is: ",list1)
list1.remove('MIT')
print("the list1 is: ",list1)
Output:
the list1 is: ['MIT', 'Yale', 'UCI']
the list1 is: ['Yale', 'UCI']
Syntax
list.remove(element)
Parameters
Name | Description |
element | The element in the list to be removed. |
Return Value
It doesn’t return any value.