You may use the keywords in and not in to determine whether an element belongs to a list or not, which is similar to and in mathematics:
L = ['a', 1, 'b', 2] 'a' in L # True 3 in L # False 4 not in L # True
You may use the keywords in and not in to determine whether an element belongs to a list or not, which is similar to and in mathematics:
L = ['a', 1, 'b', 2] 'a' in L # True 3 in L # False 4 not in L # True