@@ -19,7 +19,7 @@ Additional material:
1919| Python collections | < https://docs.python.org/3/library/collections.html > |
2020| Time complexity | < https://docs.python.org/3/tutorial/datastructures.html > |
2121
22- ## Topics
22+ ## Index
2323
24241 . [ Primitive Types] ( #primitive-types )
25251 . [ Tuples] ( #tuples )
@@ -31,10 +31,12 @@ Additional material:
31311 . [ Hash Tables] ( #hash-tables )
32321 . [ Heaps] ( #heaps )
33331 . [ Collections] ( #collections )
34- 1 . [ namedtuple] ( #collectionsnamedtuple )
35- 1 . [ defaultdict] ( #collectionsdefaultdict )
36- 1 . [ Counter] ( #collectionscounter )
37- 1 . [ OrderedDict] ( #collectionsordereddict )
34+ * [ namedtuple] ( #collectionsnamedtuple )
35+ * [ defaultdict] ( #collectionsdefaultdict )
36+ * [ Counter] ( #collectionscounter )
37+ * [ OrderedDict] ( #collectionsordereddict )
38+
39+ \newpage
3840
3941## Primitive Types
4042
@@ -63,15 +65,15 @@ Additional material:
6365>> > int (' 10a' ) # `ValueError: invalid literal for int() with base 10: '10a'`
6466
6567# Operations
66- >> > 2 * 2
67- 4
68- >> > 2 * 2 .
69- 4 .0
68+ >> > 5 * 2
69+ 10
70+ >> > 5 * 2 .
71+ 10 .0
7072>> > 5 / 2
71732.5
7274>> > 5 // 2 # `//` is the integer division
73752
74- >> > 3 % 2
76+ >> > 5 % 2
75771
7678
7779# `min` and `max`
@@ -228,20 +230,20 @@ True
228230True
229231
230232# Built-in methods
231- >> > l = [2 , 1 , 4 , 3 ]
233+ >> > l = [3 , 1 , 2 , 0 ]
232234>> > len (l)
2332354
234236>> > min (l)
235- 1
237+ 0
236238>> > max (l)
237- 4
239+ 3
238240>> > sum (l)
239- 10
240- >> > any (v == 4 for v in l)
241+ 6
242+ >> > any (v == 3 for v in l)
241243True
242244>> > any (v == 5 for v in l)
243245False
244- >> > all (v > 0 for v in l)
246+ >> > all (v >= 0 for v in l)
245247True
246248
247249# Sort list in-place (`sort`)
0 commit comments