sequences
list
python list
1 | digits = [1, 8, 2, 8] |
containers
it just search element by element
1 | 1 in digits |
for statements
1 | def count(s, value): |
range
range(1, n) from 1 to n - 1
list comprehesion
1 | [x * x for x in sets if x % 25 == 0] |
lists, Slices & Recursion
expamle
1 | def sum_list(s): |
containers
box-and-pointer Notation
the closure property of data types
- 操作的结果仍然属于相同的类型
- 闭包的强大之处在于:它允许我们构建层级结构(hierarchical structures)。
- 层级结构的本质是“部分由部分组成”。
- 在 Python 里,列表是一种具有闭包性质的数据结构
box-and-pointer Notation in environment diagrams
slicing
1 | odds = [3, 5, 7, 9, 11] |
precessing container values
there are some build-in function
sequence aggregation
`sum(literable [, other])
‘max(literable [, key])