官术网_书友最值得收藏!

Set

The final data structure we'll look at is the set. A set is a collection of data values without keys; like a list, but in no particular order, like a dictionary. We can create a set using a set expression, which is a pair of curly brackets around comma-separated values, as shown in the following code example:

Locating a specific value in a set is fast, as is adding or removing a value, as shown in the following example:

Each value can only be in the set once. Sets support a bunch of mathematical operations, such as union and intersection, and are generally more useful than might be obvious at first, though we can't really prove that here in this section.

主站蜘蛛池模板: 林甸县| 故城县| 疏附县| 金寨县| 浮梁县| 香河县| 迁安市| 双桥区| 晋宁县| 莱阳市| 博乐市| 绥江县| 郯城县| 东台市| 含山县| 遵化市| 景宁| 江永县| 黄龙县| 青田县| 武义县| 炎陵县| 清水县| 丽江市| 和林格尔县| 高台县| 扬州市| 榆树市| 阜阳市| 三明市| 绥滨县| 巴彦淖尔市| 玉环县| 东城区| 梨树县| 隆尧县| 陇南市| 夏河县| 文成县| 新安县| 陈巴尔虎旗|