0 points

Remove one element form the list


dashboard

Tue Mar 31 2020 05:21:34 GMT+0000 (UTC)

Posted by @GoByte #python #python #remove #lists

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

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

# Updated animals List
3.print('Updated animals list: ', animals)
content_copy Copy

remove() is an built in function in python that remove a given object from the list. It does not return any value.

https://www.programiz.com/python-programming/methods/list/remove