In this short lesson, we cover the important membership operators for the container types in Python. Membership operators are used to seeing whether or not a given element is present in the container one would like to check.

In the example below, we create a list called L with the elements -1,0,1. I check whether or not 0 is in it, and then I check whether the integer 10 is in it. One can check whether or not a specific number is “in” the list L as shown in the first two cells below. Also, it is possible to check whether or not an element is “not in” a…

--

--

AI | Reinforcement Learning | Python | Finance | Value. Support my writing by joining Medium (unlimited access): https://medium.com/@CalebMBowyer/membership