Python · Sets and tuples

set symmetric difference

Values in exactly one of the sets.

Syntax
a ^ b

Example

Open in the lab

More in this group

frozenset namedtuple set difference set intersection 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