Python Set - Remove Method

Method Name: remove(element_in)

Method Overview:

Removes an element from an existing python set object

Parameters:

element_in : The element that is to be removed from the python set object

Exceptions:

KeyError is raised if the specified element is not in the python set object

Example

>>> FoodPlate = {"Salmon","Beans","Bacon","Broccoli"}

>>> FoodPlate.remove("Bacon")

>>> print(FoodPlate)

{'Broccoli', 'Salmon', 'Beans'}

 


Copyright 2023 © pythontic.com