bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/Python/Foundations
Python•Foundations

Python Membership Operators

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind Python Membership Operators?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___ = "Hello World"
3Order

Put the learning moves in the order that makes the concept easiest to apply.

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

Membership Operators

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

OperatorDescriptionExample
inReturns True if a sequence with the specified value is present in the objectx in y
not inReturns True if a sequence with the specified value is not present in the objectx not in y

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)

Previous

Python Identity Operators

Next

Python Bitwise Operators