# intersection of two lists python

```>>> a = [1,2,3,4,5]
>>> b = [1,3,5,6]
>>> list(set(a) & set(b))
[1, 3, 5]```

Here is what the above code is Doing:
1. We create two lists, a and b.
2. We convert the lists to sets.
3. We use the & operator to find the intersection of the two sets.
4. We convert the resulting set back to a list.

The & operator is called the intersection operator. It returns the elements that are common to both sets.

The intersection operator is different from the &= operator, which is used to update a set with the intersection of itself and another set.

The & operator returns a new set, while the &= operator updates the original set.

The & operator can be used on any iterable type, not just sets.

The & operator is generally faster than the intersection() method.

The & operator can be used to combine multiple sets into a single set.

The & operator is commutative, meaning the order of the operands does not matter.

The & operator is associative, meaning that multiple & operations can be chained together.

The & operator is distributive, meaning that it distributes over other operators such as | (union) and – (difference).

The & operator has higher precedence than the | operator, meaning that it will be evaluated first if both operators are used in the same expression.

The & operator is generally used for set operations, while the &= operator is used for assignment.

The & operator can be overloaded for user-defined types.

The & operator is implemented in the __and__() method.

The &= operator is implemented in the __iand__() method.

The & operator is bitwise AND if both operands are integers.

The & operator is logical AND if both operands are Boolean values.

The & operator is set intersection if both operands are sets.

The & operator is intersection of iterables if both operands are any other type of iterable.