Skip to content

Commit a136625

Browse files
committed
refactor and remove unused package
1 parent b411f69 commit a136625

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This guide includes a list of several and useful `Python` data structures to kno
1111
It is intended to show the main data structures incorporated in the language
1212
and their useful functions. More advance `Python` feature will not be shown here.
1313

14-
Additional links:
14+
Additional material:
1515

1616
| **Topic** | **Link** |
1717
|---|---|
@@ -159,7 +159,7 @@ inf
159159
'a'
160160

161161
# Slicing
162-
>>> l[:] # `l[start:end]` where `end` is exclusive
162+
>>> l[:] # `l[start:end]` which means `[start, end)`
163163
[1, 2, 'a']
164164
>>> l[0:len(l)] # `start` is 0 and `end` is `len(l)` if omitted
165165
[1, 2, 'a']
@@ -176,7 +176,7 @@ inf
176176
>>> l.remove('b') # `ValueError: list.remove(x): x not in list`
177177
>>> l
178178
[2]
179-
>>> l.index(2)
179+
>>> l.index(2) # It returns first occurrence (`O(n)`)
180180
0
181181
>>> l.index(12) # `ValueError: 12 is not in list`
182182

@@ -188,6 +188,8 @@ inf
188188
5
189189
>>> [k for k in range(5)]
190190
[0, 1, 2, 3, 4]
191+
>>> [k for k in reversed(range(5))]
192+
[4, 3, 2, 1, 0]
191193

192194
# Compact way to define 2D arrays
193195
>>> rows, cols = 2, 3
@@ -199,6 +201,8 @@ True
199201

200202
# Built-in methods
201203
>>> l = [2, 1, 4, 3]
204+
>>> len(l)
205+
4
202206
>>> min(l)
203207
1
204208
>>> max(l)
@@ -496,7 +500,7 @@ Point(x=1, y=2)
496500
True
497501

498502
# Python >= 3.6.1
499-
>>> from typing import Any, NamedTuple
503+
>>> from typing import NamedTuple
500504
>>>
501505
>>> class Point(NamedTuple):
502506
... x: int

0 commit comments

Comments
 (0)