Python Set - in method

The in( ) method 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

Method Name

element in(set_in)

Method Overview

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

Parameters

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

Return Value

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

Example

python
>>> PrimeNumbers = [2,3,5,7,11,13,17,19]

>>> 10 in (PrimeNumbers)

False