- Daniel Arbuckle's Mastering Python
- Daniel Arbuckle
- 122字
- 2021-07-02 21:09:32
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.
推薦閱讀
- Python編程自學手冊
- GraphQL學習指南
- 人人都懂設計模式:從生活中領悟設計模式(Python實現)
- 3D少兒游戲編程(原書第2版)
- JavaScript入門經典
- IBM Cognos TM1 Developer's Certification guide
- Building Business Websites with Squarespace 7(Second Edition)
- Python預測分析與機器學習
- Redmine Cookbook
- 3D Printing Designs:The Sun Puzzle
- Clojure編程樂趣
- C語言程序設計
- Expert Cube Development with SSAS Multidimensional Models
- VMware vRealize Orchestrator Essentials
- Spring MVC Cookbook