🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to Python Notes
Topic #32

Membership Operators


Membership Operators

Membership operators are used to test if a sequence is presented in an object:

Operator Description Example Try it
in Returns True if a sequence with the specified value is present in the object x in y
not in Returns True if a sequence with the specified value is not present in the object x not in y

Examples

Example

fruits = ["apple", "banana", "cherry"]

print("banana" in fruits)

Example

fruits = ["apple", "banana", "cherry"]

print("pineapple" not in fruits)

Membership in Strings

The membership operators also work with strings:

Example

text = "Hello World"

print("H" in text)
print("hello" in text)
print("z" not in text)

Want to go beyond the notes?

Join CodingNow 2.0's Python course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Membership Operators – FAQs

Quick answers about learning Membership Operators in Python.

This free note from CodingNow 2.0 explains Membership Operators in Python — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every Python topic on CodingNow 2.0, including Membership Operators, is 100% free with no signup required.
With focused practice, most students grasp Membership Operators in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now