Python - Membership Operators
Python has membership operators used to check if a value exists in an object or not.
- in - checks if a value exists in an object.
- not in - checks if a value does not exist in an object.
Examples
string0 = "Hello, World!"
print("World!" in string0) # True
print("Hi" in string0) # False
tuple0 = (55, 12, 41, 7, 13)
print(7 in tuple0) # True
print(9 in not tuple0) # True
set0 = { 'bla', 'ble', 7, 11 }
print('bla' in set0) # True
print(9 in not set0) # True