Python Set - discard

Method Name: discard(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:

None. 

>>> Cars = {"Fossil Fuelled","Electric Car","Hydrogen Car"}

>>> Cars.discard("Fossil Fuelled")

>>> print(Cars)

{'Electric Car', 'Hydrogen Car'}


Copyright 2024 © pythontic.com