Site icon TestingDocs.com

Python Membership Operators

Overview

Python membership operators test for an element’s membership in Python data structures such as a sequence, string, list, or tuple.

Python Membership Operators

The membership operators are as follows:

Python Operator
Description Example
in The in operator evaluates to True if it finds a variable in the specified sequence and False otherwise. x in y, here in results in a 1 if x is a member of sequence y.
not in The not in operator evaluates to True if it does not find a variable in the specified sequence and False; otherwise x not in y, here not in results in a 1 if x is not a member of sequence y.

 

Python Tutorials

Python Tutorial on this website can be found at:

https://www.testingdocs.com/python-tutorials/

More information on Python is available at the official website:

https://www.python.org

 

Exit mobile version