Remove one element form the list

PHOTO EMBED

Tue Mar 31 2020 05:21:34 GMT+0000 (Coordinated Universal Time)

Saved 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_copyCOPY

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