Commit 45f02d76 authored by Loic Huder's avatar Loic Huder
Browse files

Some typo corrections.

parent 2a0c45f5
Pipeline #33207 passed with stage
in 1 minute and 4 seconds
......@@ -16,7 +16,7 @@
"\n",
"# [Data structures](https://docs.python.org/3/tutorial/datastructures.html)\n",
"\n",
"4 built-in containers: list, tuple, set and dict...\n",
"4 built-in containers: list, tuple, set and dict.\n",
"\n",
"For more containers: see [collections](https://docs.python.org/3/library/collections.html)..."
]
......@@ -82,7 +82,7 @@
"source": [
"### list: mutable sequence\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 @@
"assert t0 == t1\n",
"\n",
"# not empty tuple\n",
"t2 = (1, 2, 'a') # with the parenthesis\n",
"t2 = 1, 2, 'a' # it also works without parenthesis\n",
"t2 = (1, 2, 'a') # with the parentheses\n",
"t2 = 1, 2, 'a' # it also works without parentheses\n",
"t3 = tuple(l3) # from a list"
]
},
......@@ -635,13 +635,13 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Complity :\n",
"## Complexity :\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",
" \n",
" -> Complixity of the whole algorithm : O(n)\n",
" -> Complexity of the whole algorithm : O(n)\n",
" \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) "
......@@ -795,7 +795,9 @@
"cell_type": "markdown",
"metadata": {},
"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."
]
},
{
......@@ -869,8 +871,7 @@
"source": [
"# loop with items\n",
"for key, value in d.items():\n",
" if isinstance(key, str): \n",
" print(key, value)"
" print(key, value)"
]
},
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment