Python Set add() Method

Python Set add() Method

The set.add() method adds the specified element to a set. If the element is already present in the set, it doesn’t add it.

Syntax

Parameter

element- This parameter represents the element that is to be added to the set.

Return

None

Example 1

Output

Example 2

Output