set:
Empty collection set ()
Only
additions and deletions check can not be changed
Itself is
a variable data type (not hashed)
Inside the
element is immutable (hashable),
Disorderly, not repeat
Lists, dictionaries are variable, not as a collection of elements
Role:
to re-test the relationship
= [1,2,3,4,5,5,4,3,2,1]
a = list(set(li))
print(a)
Add increase
update with additional iterations
Remove deleted by elements
Pop delete a random element
Clear Clear collection
Del set to delete the entire collection
Frozenset set becomes immutable.
Relationship test:
Intersection. (Or & intersection)
Union. (| Or union)
Difference sets. (- or difference)
Anti intersection. (^ Or symmetric_difference)
Subset <return bool
Superset> bool return
Interview questions:
1, list, dict, set, tuple any difference.
2,l1 = [1,5,3,4,2]
l2 = [5, 3, 6, 8, 9]
The combined both a list in ascending order, removing duplicate elements