Python Set - not in function

The not in( ) function tests whether an element is a member of a set object and returns a boolean value based on the membership

Set Updated 16 Sep 2016 1 min read

Function Name

element not in(set_in)

Function Overview

The not in() function checks whether an element is not present in the set.

Parameters

set_in: The set in which the non-membership of an element to be checked for.

Return Value

returns True if the element is not present in the python set.
returns False if the element is present in the python set.

Example

python
>>> Palindromes = ["Kayak","Madam","Bob","Civic"]

>>> "Man" not in (Palindromes)

True