Last active
April 15, 2017 17:00
-
-
Save venkatsgithub1/9c485cf542d05b1a125012b54526d5ab to your computer and use it in GitHub Desktop.
Python | Removal of data from list using remove method.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Usage of remove method to remove elements from list. | |
list_of_items=["Watch", "Headphones", "Mobile Phone", "Laptop"] | |
""" | |
****************************** | |
remove method removes the | |
actual element passed | |
from the list. | |
Data passed into remove method | |
not being part of list will | |
result in an error. | |
remove method doesn't return | |
anything back. | |
****************************** | |
Below line removes Laptop from | |
list_of_items. | |
list_of_items becomes | |
['Watch', 'Headphones', 'Mobile Phone'] | |
""" | |
list_of_items.remove ("Laptop") | |
print (list_of_items) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment