Abbreviated as a set, it is a "determined bunch of things", and the "things" in the collection are called elements.It is also a basic concept in mathematics and the main research object of set theory.A set that does not contain any elements is called an "empty set".
In python, sets are defined with {items,...} or set(iterable); empty sets can only be represented by set(), not {}.
>> set1 = {1,2,3}>>> set2 = set([1,2,3])>>> set1{1, 2, 3}>>> set2{1, 2, 3}>>> set0 = set()>>> type(set0)>>> type({}) # {} means empty dictionary
Given a set, give any element, the element either belongs to the set or does not belong to the set, the two must be one of the two, and no ambiguity is allowed.
In a set, any two elements are considered to be different, that is, each element can only appear once.Sometimes it is necessary to characterize the situation where the same element appears multiple times, and multiple sets can be used, in which elements are allowed to appear multiple times.