Which of the following is a membership operator in Python?

2026

Which of the following is a membership operator in Python?

  1. A.

    ==

  2. B.

    in

  3. C.

    not

  4. D.

    +=

Attempted by 309 students.

Show answer & explanation

Correct answer: B

In Python, membership operators test whether a value exists within a sequence. The 'in' operator is the primary membership operator, returning True if an element is found in a list, string, or tuple. For example, 'a' in ['a', 'b'] evaluates to True.

Explore the full course: Rssb Senior Computer Instructor