Python · Sets and tuples

set intersection

Only the values present in both sets.

Syntax
a & b

Example

Open in the lab

More in this group

frozenset namedtuple set difference set symmetric difference set union set.add() set.discard() / remove() set.issubset()

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course