Answers for "remove element python"

3

delete element from list value

>>> a=[1,2,3]
>>> a.remove(2)
>>> a
[1, 3]
>>> a=[1,2,3]
>>> del a[1]
>>> a
[1, 3]
>>> a= [1,2,3]
>>> a.pop(1)
2
>>> a
[1, 3]
>>>
Posted by: Guest on May-19-2020
3

remove element from list python

# animals list
animals = ['cat', 'dog', 'rabbit', 'guinea pig']

# 'rabbit' is removed
animals.remove('rabbit')

# Updated animals List
print('Updated animals list: ', animals)
Posted by: Guest on May-01-2020

Code answers related to "remove element python"

Python Answers by Framework

Browse Popular Code Answers by Language