In this lesson, you’ll see how operators and Python’s built-in functions can be applied to lists. Several Python operators can be used with lists. in and not in are membership operators and can be used with lists. A membership operator used on a list:
- Returns
Trueif the first operand is contained within the second - Returns
Falseotherwise - Can also be used as
not in
Here’s an example:
>>> a = ['spam', 'egg', 'bacon', 'tomato', 'ham', 'lobster']
>>> a
['spam', 'egg', 'bacon', 'tomato', 'ham', 'lobster']
>>> 'spam' in a
True
>>> 'egg' in a
True
>>> 'kiwi' in a
False
>>> 'kiwi' not in a
True
Here’swhat happens with the concatenation (+) and replication (*) operators:

mnemonic6502 on Feb. 5, 2020
This should be the learning template all video tutorials should adopt on this site, great job!