Python Set remove() method

Facebooktwitterredditpinterestlinkedinmailby feather

Python Set remove() method

The set.remove() method in Python removes the specified element from the set if it is present in the set else this method will raise an error if the specified item does not exist.

Syntax

Parameter

element- This parameter signifies the item to search for and later to  remove it.  

Return

This method returns the specified element from the set.

Example 1

Output

Example 2

Output

Example 3

Output

Facebooktwitterredditpinterestlinkedinmailby feather