Python set.add() Method
The add() method adds an element to the set.
If the element already exists, the add() method does not add the element.
Syntax
set.add(elmnt)
Parameters
| Parameter | Description |
|---|---|
elmnt |
Required. The element to add to the set |
Return Value
None.
Example
Using the add() method:
Output
Click Run to execute your code
Enjoying these tutorials?