O'Reilly logo

Python: Essential Reference, Third Edition by David Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Operations on Sets

The set and frozenset type support a number of common set operations:

OperationDescription
s | tUnion of s and t
s & tIntersection of s and t
s – tSet difference
s ^ tSymmetric difference
len(s)Number of items in the set
max(s)Maximum value
min(s)Minimum value

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required