Home > Articles > Programming > Python

  • Print
  • + Share This
This chapter is from the book

Operations on Sets

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

Operation

Description

s | t

Union of s and t

s & t

Intersection of s and t

s – t

Set difference

s ^ t

Symmetric difference

len(s)

Number of items in the set

max(s)

Maximum value

min(s)

Minimum value

  • + Share This
  • 🔖 Save To Your Account