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

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.

主站蜘蛛池模板: 绍兴县| 剑河县| 出国| 菏泽市| 额济纳旗| 玉溪市| 河津市| 伊金霍洛旗| 全州县| 汉阴县| 台中市| 古交市| 新野县| 清新县| 威远县| 牟定县| 吴堡县| 万州区| 宁南县| 茂名市| 灵川县| 砀山县| 渝中区| 工布江达县| 和龙市| 兖州市| 家居| 高尔夫| 江川县| 云安县| 新泰市| 汽车| 神木县| 淮阳县| 加查县| 龙江县| 柘城县| 盐边县| 绥中县| 湖口县| 武定县|