liveBook · Manning

Membership operator

A membership operator is a language construct that tests whether a specified value or property is present in a supported collection, range, or object.

How 8 Manning books explain it

Tiny Python Projects: Learn coding and testing with puzzles and games

A membership expression tests whether a value occurs in a collection or other container.

How it is used
Uses membership tests to choose branches, verify list contents, guard dictionary lookups, and find matching input keys.
How deep it goes
Defines Boolean presence tests across strings, lists, and dictionaries, but does not detail implementation internals or performance.
Examples
Demonstrates vowel checks, picnic-item checks, dictionary-key checks, and letter matching in a command-line lookup program.
What you can do after
Apply it via Python expressions to test presence before branching, retrieving values, or reporting unknown input.

Read how Tiny Python Projects: Learn coding and testing with puzzles and games explains membership operator →

Kotlin in Action, 2E

The `in` operator tests whether a value belongs to a collection, range, or other container by invoking its containment operation.

How it is used
Uses concise membership checks for validating characters, classifying values, querying collections, and iterating over containers.
How deep it goes
Explains range and collection checks, comparable ranges, open endpoints, and the `contains` convention for custom classes.
Examples
Demonstrates character predicates, `when` branches, string and set membership, and rectangle containment.
What you can do after
Apply it via Kotlin syntax to test ranges and collections or implement `contains` for custom containment behavior.

Read how Kotlin in Action, 2E explains membership operator →

Learn SQL in a Month of Lunches

The IN operator is an SQL predicate that tests whether an expression matches any value in a specified list or subquery result.

How it is used
Consolidates multiple equality filters in WHERE clauses and matches expressions against subquery results.
How deep it goes
Defines list syntax, demonstrates numeric and date filters, compares IN with OR and ANY, and applies it in a CHECK constraint.
Examples
Uses title prices, publication dates, order items, excluded prices, and shipment methods limited to P or E.
What you can do after
Apply it via SQL to filter listed values, match subquery results, exclude values, and validate permitted column values.

Read how Learn SQL in a Month of Lunches explains membership operator →

Python Workout: 50 ten-minute exercises

Python's membership operator tests whether a value occurs within a container or iterable.

How it is used
Uses membership tests to replace repetitive conditionals, validate dictionary keys, and guide text-processing decisions.
How deep it goes
Explains syntax, supported containers, dictionary key behavior, and linear search, but stops short of membership protocol internals.
Examples
Demonstrates vowel detection, dictionary-backed restaurant ordering, menu validation, prices, and running totals.
What you can do after
Apply membership tests to search sequences, validate dictionary keys, and replace repetitive loops or comparisons.

Read how Python Workout: 50 ten-minute exercises explains membership operator →

The Quick Python Book, Fourth Edition

The in operator is a Python comparison operator that tests whether a value is contained in a collection.

How it is used
Tests whether a value belongs to a list, tuple, string, dictionary, or set.
How deep it goes
Defines Boolean membership and contrasts existence checks with index-based position lookup, without discussing implementation internals.
Examples
Uses numeric and string lists, sets with duplicate removal, character strings, and guarded list searches.
What you can do after
Apply it to check collection membership and guard index or removal operations against missing values.

Read how The Quick Python Book, Fourth Edition explains membership operator →

Python Workout, Second Edition

The in operator is Python's membership operator for testing whether a value occurs in a container or iterable.

How it is used
Uses membership testing to simplify sequence searches and validate dictionary keys in small Python programs.
How deep it goes
Explains syntax, supported containers, dictionary key behavior, search cost, and input-matching pitfalls without descending into implementation internals.
Examples
Demonstrates vowel detection and an interactive restaurant menu that accepts known dishes and rejects unknown ones.
What you can do after
Apply the in operator to write concise sequence tests and safely check dictionary keys before retrieving values.

Read how Python Workout, Second Edition explains membership operator →

Get Programming: Learn to code with Python

How it is used
Uses string searches to locate substrings and determine whether they occur.
How deep it goes
Explains find() and rfind() results with examples, but does not detail membership-operator syntax or behavior.
Examples
Shows searching for "and" and "you" in "me myself and I" and finding "ing" in "some_string".
What you can do after
Evaluate substring searches with find() and interpret the returned index or -1.

Read how Get Programming: Learn to code with Python explains membership operator →

Essential TypeScript 5, Third Edition

The in keyword is a JavaScript operator that tests whether an object defines a specified property or inherited property.

How it is used
Uses property membership to distinguish object shapes and narrow union types inside conditional branches.
How deep it goes
Explains syntax, narrowing behavior, and discriminating-property selection, but defers the full catalogue of common guard errors.
Examples
Uses Product and Person objects, city and price checks, and compiled output distinguishing Bob from three products.
What you can do after
Apply it via JavaScript and TypeScript to select safely narrowed branches for heterogeneous object arrays.

Read how Essential TypeScript 5, Third Edition explains membership operator →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.