This website's section provides a detailed exploration of the built-in functions and operations available for working with set data structures. This page covers the various ways you can add, remove, and query elements within a set, as well as perform common set-theoretic operations like union, intersection, and difference. It explains how to iterate over set contents, check set membership, and convert between sets and other data types. The information on this page serves as a comprehensive reference for leveraging sets and their associated methods to write efficient, expressive, and highly-functional Python code that takes advantage of sets' unique properties and capabilities.
Function | Description |
---|---|
add() | The |
clear() | The |
copy() | The |
difference() | The |
difference_update() | The |
discard() | The |
intersection() | The |
intersection_update() | The |
isdisjoint() | The |
issubset() | The |
issuperset() | The |
pop() | The |
remove() | The |
symmetric_difference() | The |
symmetric_difference_update() | A method used to update a set by removing the elements that are present in both sets, and inserting the elements from the other set that are not common. |
union() | A method of the Set data type that returns a new set containing all the elements present in the original set as well as the elements from one or more other sets. |
update() | The |