Real Python Tutorials

Python's "in" and "not in" Operators: Check for Membership
NEW

Checking for Membership Using Python's "in" and "not in" Operators

In this video course, you'll learn how to check if a given value is present or absent in a collection of values using Python's in and not in operators, respectively. This type of check is known as membership test in Python.

Apr 08, 2025 basics best-practices python