Grade 8 · lesson 1 of 4

Distinguish a Membership Test from an Index

Check whether the queried value exists anywhere in the supplied collection.

About 18 minutes, plus any extended practice

Download the grade pack

Supplied materials

  • Paper and pencil; answers may also be spoken or typed.
  • All cases, labels, numbers and rules are supplied on this page. No real account, private information or purchase is needed.

Learn the idea

Membership asks whether a value appears in a collection. Indexing asks for a value at a particular position. Python in returns a Boolean for the supplied list or set. It does not report how many times a value appears or where the first match occurs.

Check whether the queried value exists anywhere in the supplied collection. A true membership result is not a numeric occurrence count.

Use this supplied case: Paper Python 3 expression: 3 in [1,3,5]. What value results? The task is to connect the given information to the computing idea. Write a short evidence trail so another learner can reproduce your choice. The simplified case describes the stated model, not every real system.

  1. Represent the supplied worked case with a labeled drawing, table or short trace.
  2. Check whether the queried value exists anywhere in the supplied collection.
  3. Explain why the worked answer fits and why one alternative does not.
  4. Try the new check and practice cases; revisit the stated rule if your evidence does not match.
Worked example

See the method in action

Paper Python 3 expression: 3 in [1, 3, 5]. What value results? The supported answer is True. Tracing the expression under Python 3 rules gives True. Check whether the queried value exists anywhere in the supplied collection. A true membership result is not a numeric occurrence count. Membership asks whether a value appears in a collection.

Your turn

Check your reasoning

Your answer is temporary and is not saved to an account. Download your current answer before leaving or reloading. Written work on paper or in another app stays in your own file.

Helpful tips
  • Check whether the queried value exists anywhere in the supplied collection.
  • A true membership result is not a numeric occurrence count.
Paper Python 3 expression: 4 in [1,3,5]. What value results?

Feedback appears here after you check. This is practice, not a graded school assessment.

See the answer and explanation

False

The requested value is 4 and the collection is [1, 3, 5]. Membership asks whether at least one equal item appears, giving False; it does not return an index or occurrence count. Check whether the queried value exists anywhere in the supplied collection.

Take it further

For values=[2, 2, 9], the expression 2 in values is True. Expected: membership confirms at least one matching item; it does not report that 2 appears twice. Supply a separate occurrence-count rule if that is the question.

Nothing here is saved to an account or sent to a teacher. The answer download includes your current choice and any checked feedback. It does not include choices from the separate More practice section. Download that section separately.

More practice: try new cases

Choose an answer for each problem. Explain your method on paper, then use the feedback to decide what to revisit.

More practice: try new cases
1. Paper Python 3 expression: 2 in [2,2,7]. What value results?
Need a hint?
  • Check whether the queried value exists anywhere in the supplied collection.
  • A true membership result is not a numeric occurrence count.
2. Paper Python 3 expression: 8 in []. What value results?
Need a hint?
  • Check whether the queried value exists anywhere in the supplied collection.
  • A true membership result is not a numeric occurrence count.
3. Paper Python 3 expression: "red" in ["blue","red"]. What value results?
Need a hint?
  • Check whether the queried value exists anywhere in the supplied collection.
  • A true membership result is not a numeric occurrence count.

Your choices are temporary. Feedback appears after you check all the answers.

Nothing here is saved to an account or sent to a teacher. Keep your own notes or download them before leaving. The score describes these questions; it does not certify subject mastery.

Check the subject sources

These LifeStarter passages, scenarios and exercises are authored for this Academy with AI assistance and review. External resources keep their publishers’ terms. A grade label suggests a starting level; it does not establish alignment with your school’s complete requirements.