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

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.

主站蜘蛛池模板: 会东县| 临泽县| 剑川县| 吴堡县| 沙田区| 绍兴市| 深圳市| 砀山县| 平度市| 武安市| 福海县| 邻水| 富裕县| 黎平县| 濮阳县| 肃北| 永川市| 蒙城县| 鄂温| 星子县| 巴青县| 吴桥县| 盐亭县| 江阴市| 夹江县| 布尔津县| 云和县| 横山县| 沂源县| 门源| 磴口县| 张家港市| 化州市| 遵义市| 伊宁市| 星座| 手机| 东乡| 乐亭县| 三河市| 会宁县|