The concept of set is somewhat similar to a hash table, which is a set of elements that are unordered but not duplicated. Lists, Ganso, and dictionary data can be duplicated.
The set can be easily calculated and compared for intersection, difference, symmetry difference, and set, which is more complex in other sequence operations . .
, a set set is created with the SET command:
With the set defined, we can do the following:
- Add an element, add an element 7
- Add more than one element at a time, adding 7,9,11
- Delete an element, remove the 5 in a
- Find the length of the set, and find the length of 6
- View whether a value is an element of another set, or is not a member of another set.
- To see if all the elements of a set set are in another set,
- Intersection of 2 set, {1,3}.
- Set can go heavy, and the repeated 1,2,3,4 numbers are automatically removed.
Symmetry difference: b^a, symmetric_difference removed 2 elements (opposite to the intersection).
Sync Difference
Ask for a hand
- Combine union, B|a, remove duplicate elements, merge into a set
- Asks if a set is in another set, and C,d is set in B.
- Sets a string for the set conversion,
- The copy of set is a shallow copy,
- Pop is used to remove an indeterminate element from the set and return it,
Python automation developed from shallow into deep-language Foundation (set)