Definition:
It checks if a value is NOT present in a sequence. If it is not present, it returns True. Otherwise, it returns False.
Now you will clearly understand with the help of the diagram.
a (value) ────────────────┐
↓
┌─────────────┐
│ 1, 2 │ ← (sequence / object)
└─────────────┘
Here, the value 3 is not present in the sequence.
Syntax:
a not in b
Example:
a = 3
b = [1, 2]
print(a not in b)
Output:
True
