Today, let's talk about set.
Collection: is an unordered set (collection) of some unique, immutable objects (numeric and string, etc.), and these objects support operations that correspond to the mathematical set theory.
Characteristics:
1. A single item can only appear once
2. Widespread use in digital and database work
3. Two sets cannot be added with +, but can use-subtract
Here are some of the operations of the collection, the middle section I deliberately use the + number, direct error
2. Some common methods in the collection
3. Note: Because the collection includes only immutable objects, lists and dictionaries cannot be embedded in the collection, and the collection cannot be embedded in the collection
4. Set resolution
5. Why do I need a collection
1) When traversing a back-type structure, the collection guarantees that the structure traverses only one side, because the collection only holds the object once
2) When querying a database, you need to compare two sets
Right here, thank you.
------------------------------------------------------------------
Click to jump 0 basic python-Catalogue
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
0 Basic python-5.9 Set Set