in Operator¶
The in
operator is used to check wether a container (for example an
iterable like a list
) contains a value.
Example:
name = "John"
print(name in ["John", "Rick"]) # prints out True
print(name in ["Rick", "Paul"]) # prints out False
print(name not in ["John", "Rick"]) # prints out False