"4 built-in containers: list, tuple, set and dict...\n",

"4 built-in containers: list, tuple, set and dict.\n",

"\n",

"\n",

"For more containers: see [collections](https://docs.python.org/3/library/collections.html)..."

"For more containers: see [collections](https://docs.python.org/3/library/collections.html)..."

]

]

...

@@ -82,7 +82,7 @@

...

@@ -82,7 +82,7 @@

"source": [

"source": [

"### list: mutable sequence\n",

"### list: mutable sequence\n",

"\n",

"\n",

"The builtin function `dir` returns a list of name of the attributes. For a list, these attributes are python system attributes (with double-underscores) and 11 public methods:\n"

"The built-in function `dir` returns a list of name of the attributes. For a list, these attributes are python system attributes (with double-underscores) and 11 public methods:\n"

]

]

},

},

{

{

...

@@ -348,8 +348,8 @@

...

@@ -348,8 +348,8 @@

"assert t0 == t1\n",

"assert t0 == t1\n",

"\n",

"\n",

"# not empty tuple\n",

"# not empty tuple\n",

"t2 = (1, 2, 'a') # with the parenthesis\n",

"t2 = (1, 2, 'a') # with the parentheses\n",

"t2 = 1, 2, 'a' # it also works without parenthesis\n",

"t2 = 1, 2, 'a' # it also works without parentheses\n",

"t3 = tuple(l3) # from a list"

"t3 = tuple(l3) # from a list"

]

]

},

},

...

@@ -635,13 +635,13 @@

...

@@ -635,13 +635,13 @@

"cell_type": "markdown",

"cell_type": "markdown",

"metadata": {},

"metadata": {},

"source": [

"source": [

"## Complity :\n",

"## Complexity :\n",

"\n",

"\n",

" - line 1: n insertions --> O(n)\n",

" - line 1: n insertions --> O(n)\n",

" - line 2: n insertions --> O(n)\n",

" - line 2: n insertions --> O(n)\n",

" - line 3: one traversal O(n), with one lookup at each time (O(1) -> O(n) \n",

" - line 3: one traversal O(n), with one lookup at each time (O(1) -> O(n) \n",

" \n",

" \n",

" -> Complixity of the whole algorithm : O(n)\n",

" -> Complexity of the whole algorithm : O(n)\n",

" \n",

" \n",

"# Complexity of the \"sum\" solution : \n",

"# Complexity of the \"sum\" solution : \n",

" - One traversal for the computation of the sum O(n) with sum at each step O(1) -> O(n) "

" - One traversal for the computation of the sum O(n) with sum at each step O(1) -> O(n) "

...

@@ -795,7 +795,9 @@

...

@@ -795,7 +795,9 @@

"cell_type": "markdown",

"cell_type": "markdown",

"metadata": {},

"metadata": {},

"source": [

"source": [

"But warning, `dict` are not ordered (since they are based on a hashtable)!"

"**Warning:** In general, `dict` are not ordered (since they are based on a hashtable)! \n",

"\n",

"However, since Python 3.6, the implementation changed so that `dict` now keep the order of insertion of keys."