This article is part of in the series

In Python, the word "in" can be used as a membership test operator. It's a great way to check if a certain value exists in a Python object. See the example below to understand how it's used in context:

>>>a = "Learning Python is super fun!"
>>>"super" in a

The above example demonstrates how the "in" operator is used. The second line of code ("super" in a) is checking whether or not the combination of characters "super" (exactly in that order) appears in the string a. As you can probably see, it does appear in the string a so the output of the membership test we conducted using the "in" operator is TRUE. When used in this context, the in operator will always return a boolean value (true or false), and using it is a great, efficient way to test and check whether or not a certain value or character set exists in any object.