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

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.

主站蜘蛛池模板: 芜湖县| 浮山县| 通道| 白水县| 施甸县| 裕民县| 龙海市| 平遥县| 湖州市| 望城县| 温州市| 丹东市| 宁波市| 山东省| 民权县| 香河县| 武义县| 嘉荫县| 吉隆县| 沙雅县| 南昌市| 和硕县| 九台市| 峡江县| 奎屯市| 奉节县| 扎囊县| 视频| 阳新县| 汝州市| 新晃| 裕民县| 龙川县| 海阳市| 南川市| 平南县| 林口县| 东宁县| 厦门市| 习水县| 扶余县|