# Membership Operator (in)

*noun*

say it: **“MEM-ber-ship OP-uh-ray-ter”** **/ˈmɛmbərˌʃɪp ˈɑpəˌreɪtɚ/** or **“in”** **/ɪn/**

The word in used as a question: it checks whether a value is inside a list, string, dictionary or other collection and answers True or False.

## What does the `in` operator do?

The `in` operator checks whether a value is inside a list, string, dictionary or other collection, and answers `True` or `False`.

```python
allergies = ["peanuts", "shellfish"]
print("peanuts" in allergies)  # True
print("gluten" in allergies)   # False
```

## In a sentence

- “The **membership operator** checks whether "peanuts" is in the customer's list of allergies.”
- “Before adding a song, the playlist code uses the **membership operator** to see if it's already there.”

Level: Apprentice · [More Python terms at this level](https://www.ask-codey.com/glossary?category=python&level=2)

Updated: November 19, 2026

Source: https://www.ask-codey.com/glossary/membership-operator-in
