ch02: exception handling in example

This commit is contained in:
Luciano Ramalho
2019-04-06 18:06:32 -03:00
parent 57966cfd53
commit e2122fbcdc

View File

@@ -663,20 +663,33 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"By design, this example raises an exception::\n", "By design, this example raises an exception::"
"\n",
"```python\n",
">>> l[2:5] = 100\n",
"Traceback (most recent call last):\n",
" ...\n",
"TypeError: can only assign an iterable\n",
"```"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 25, "execution_count": 25,
"metadata": {}, "metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"TypeError('can only assign an iterable')\n"
]
}
],
"source": [
"try:\n",
" l[2:5] = 100\n",
"except TypeError as e:\n",
" print(repr(e))"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
@@ -684,7 +697,7 @@
"[0, 1, 100, 22, 9]" "[0, 1, 100, 22, 9]"
] ]
}, },
"execution_count": 25, "execution_count": 26,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -703,7 +716,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 26, "execution_count": 27,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -712,7 +725,7 @@
"[1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]" "[1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]"
] ]
}, },
"execution_count": 26, "execution_count": 27,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -724,7 +737,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 27, "execution_count": 28,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -733,7 +746,7 @@
"'abcdabcdabcdabcdabcd'" "'abcdabcdabcdabcdabcd'"
] ]
}, },
"execution_count": 27, "execution_count": 28,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -758,7 +771,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 28, "execution_count": 29,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -767,7 +780,7 @@
"[['_', '_', '_'], ['_', '_', '_'], ['_', '_', '_']]" "[['_', '_', '_'], ['_', '_', '_'], ['_', '_', '_']]"
] ]
}, },
"execution_count": 28, "execution_count": 29,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -779,7 +792,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 29, "execution_count": 30,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -788,7 +801,7 @@
"[['_', '_', '_'], ['_', '_', 'X'], ['_', '_', '_']]" "[['_', '_', '_'], ['_', '_', 'X'], ['_', '_', '_']]"
] ]
}, },
"execution_count": 29, "execution_count": 30,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -807,7 +820,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 30, "execution_count": 31,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -816,7 +829,7 @@
"[['_', '_', '_'], ['_', '_', '_'], ['_', '_', '_']]" "[['_', '_', '_'], ['_', '_', '_'], ['_', '_', '_']]"
] ]
}, },
"execution_count": 30, "execution_count": 31,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -828,7 +841,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 31, "execution_count": 32,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -837,7 +850,7 @@
"[['_', '_', 'O'], ['_', '_', 'O'], ['_', '_', 'O']]" "[['_', '_', 'O'], ['_', '_', 'O'], ['_', '_', 'O']]"
] ]
}, },
"execution_count": 31, "execution_count": 32,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -856,7 +869,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 32, "execution_count": 33,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -865,7 +878,7 @@
"[['_', '_', '_'], ['_', '_', '_'], ['_', '_', '_']]" "[['_', '_', '_'], ['_', '_', '_'], ['_', '_', '_']]"
] ]
}, },
"execution_count": 32, "execution_count": 33,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -880,7 +893,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 33, "execution_count": 34,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -889,7 +902,7 @@
"[['_', '_', '_'], ['_', '_', '_'], ['X', '_', '_']]" "[['_', '_', '_'], ['_', '_', '_'], ['X', '_', '_']]"
] ]
}, },
"execution_count": 33, "execution_count": 34,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -908,16 +921,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 34, "execution_count": 35,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"140413155609544" "139840389979848"
] ]
}, },
"execution_count": 34, "execution_count": 35,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -929,7 +942,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 35, "execution_count": 36,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -938,7 +951,7 @@
"[1, 2, 3, 1, 2, 3]" "[1, 2, 3, 1, 2, 3]"
] ]
}, },
"execution_count": 35, "execution_count": 36,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -950,16 +963,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 36, "execution_count": 37,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"140413155609544" "139840389979848"
] ]
}, },
"execution_count": 36, "execution_count": 37,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -970,16 +983,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 37, "execution_count": 38,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"140413154489904" "139840321336880"
] ]
}, },
"execution_count": 37, "execution_count": 38,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -991,16 +1004,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 38, "execution_count": 39,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"140413265327592" "139840440497640"
] ]
}, },
"execution_count": 38, "execution_count": 39,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1019,7 +1032,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 39, "execution_count": 40,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1040,7 +1053,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 40, "execution_count": 41,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1049,7 +1062,7 @@
"(1, 2, [30, 40, 50, 60])" "(1, 2, [30, 40, 50, 60])"
] ]
}, },
"execution_count": 40, "execution_count": 41,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1067,7 +1080,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 41, "execution_count": 42,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1102,7 +1115,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 42, "execution_count": 43,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1111,7 +1124,7 @@
"['apple', 'banana', 'grape', 'raspberry']" "['apple', 'banana', 'grape', 'raspberry']"
] ]
}, },
"execution_count": 42, "execution_count": 43,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1123,7 +1136,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 43, "execution_count": 44,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1132,7 +1145,7 @@
"['grape', 'raspberry', 'apple', 'banana']" "['grape', 'raspberry', 'apple', 'banana']"
] ]
}, },
"execution_count": 43, "execution_count": 44,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1143,7 +1156,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 44, "execution_count": 45,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1152,7 +1165,7 @@
"['raspberry', 'grape', 'banana', 'apple']" "['raspberry', 'grape', 'banana', 'apple']"
] ]
}, },
"execution_count": 44, "execution_count": 45,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1163,7 +1176,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 45, "execution_count": 46,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1172,7 +1185,7 @@
"['grape', 'apple', 'banana', 'raspberry']" "['grape', 'apple', 'banana', 'raspberry']"
] ]
}, },
"execution_count": 45, "execution_count": 46,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1183,7 +1196,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 46, "execution_count": 47,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1192,7 +1205,7 @@
"['raspberry', 'banana', 'grape', 'apple']" "['raspberry', 'banana', 'grape', 'apple']"
] ]
}, },
"execution_count": 46, "execution_count": 47,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1203,7 +1216,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 47, "execution_count": 48,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1212,7 +1225,7 @@
"['grape', 'raspberry', 'apple', 'banana']" "['grape', 'raspberry', 'apple', 'banana']"
] ]
}, },
"execution_count": 47, "execution_count": 48,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1223,7 +1236,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 48, "execution_count": 49,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1232,7 +1245,7 @@
"['apple', 'banana', 'grape', 'raspberry']" "['apple', 'banana', 'grape', 'raspberry']"
] ]
}, },
"execution_count": 48, "execution_count": 49,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1258,7 +1271,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 49, "execution_count": 50,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1292,20 +1305,20 @@
"ROW_FMT = '{0:2d} @ {1:2d} {2}{0:<2d}'\n", "ROW_FMT = '{0:2d} @ {1:2d} {2}{0:<2d}'\n",
"\n", "\n",
"def demo(haystack, needles, bisect_fn):\n", "def demo(haystack, needles, bisect_fn):\n",
" print('DEMO:', bisect_fn.__name__) # <5>\n", " print('DEMO:', bisect_fn.__name__) # <1>\n",
" print('haystack ->', ' '.join('%2d' % n for n in haystack))\n", " print('haystack ->', ' '.join('%2d' % n for n in haystack))\n",
" for needle in reversed(needles):\n", " for needle in reversed(needles):\n",
" position = bisect_fn(haystack, needle) # <1>\n", " position = bisect_fn(haystack, needle) # <2>\n",
" offset = position * ' |' # <2>\n", " offset = position * ' |' # <3>\n",
" print(ROW_FMT.format(needle, position, offset)) # <3>\n", " print(ROW_FMT.format(needle, position, offset)) # <4>\n",
"\n", "\n",
"demo(HAYSTACK, NEEDLES, bisect.bisect)\n", "demo(HAYSTACK, NEEDLES, bisect.bisect) # <5>\n",
"# END BISECT_DEMO" "# END BISECT_DEMO"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 50, "execution_count": 51,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1341,7 +1354,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 51, "execution_count": 52,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1350,7 +1363,7 @@
"['F', 'D', 'D', 'C', 'C', 'B', 'B', 'A', 'A']" "['F', 'D', 'D', 'C', 'C', 'B', 'B', 'A', 'A']"
] ]
}, },
"execution_count": 51, "execution_count": 52,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1372,7 +1385,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 52, "execution_count": 53,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1381,7 +1394,7 @@
"['F', 'F', 'D', 'D', 'C', 'C', 'B', 'B', 'A']" "['F', 'F', 'D', 'D', 'C', 'C', 'B', 'B', 'A']"
] ]
}, },
"execution_count": 52, "execution_count": 53,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1403,7 +1416,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 53, "execution_count": 54,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1459,7 +1472,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 54, "execution_count": 55,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1468,7 +1481,7 @@
"0.5963321947530882" "0.5963321947530882"
] ]
}, },
"execution_count": 54, "execution_count": 55,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1483,7 +1496,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 55, "execution_count": 56,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1493,7 +1506,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 56, "execution_count": 57,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1502,7 +1515,7 @@
"0.5963321947530882" "0.5963321947530882"
] ]
}, },
"execution_count": 56, "execution_count": 57,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1518,7 +1531,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 57, "execution_count": 58,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1527,7 +1540,7 @@
"True" "True"
] ]
}, },
"execution_count": 57, "execution_count": 58,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1552,7 +1565,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 58, "execution_count": 59,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1561,7 +1574,7 @@
"5" "5"
] ]
}, },
"execution_count": 58, "execution_count": 59,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1574,7 +1587,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 59, "execution_count": 60,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1583,7 +1596,7 @@
"-2" "-2"
] ]
}, },
"execution_count": 59, "execution_count": 60,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1594,7 +1607,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 60, "execution_count": 61,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1603,7 +1616,7 @@
"[254, 255, 255, 255, 0, 0, 1, 0, 2, 0]" "[254, 255, 255, 255, 0, 0, 1, 0, 2, 0]"
] ]
}, },
"execution_count": 60, "execution_count": 61,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1615,7 +1628,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 61, "execution_count": 62,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1624,7 +1637,7 @@
"array('h', [-2, -1, 1024, 1, 2])" "array('h', [-2, -1, 1024, 1, 2])"
] ]
}, },
"execution_count": 61, "execution_count": 62,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1650,7 +1663,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 62, "execution_count": 63,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1659,7 +1672,7 @@
"array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])" "array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])"
] ]
}, },
"execution_count": 62, "execution_count": 63,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1672,7 +1685,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 63, "execution_count": 64,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1681,7 +1694,7 @@
"numpy.ndarray" "numpy.ndarray"
] ]
}, },
"execution_count": 63, "execution_count": 64,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1692,7 +1705,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 64, "execution_count": 65,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1701,7 +1714,7 @@
"(12,)" "(12,)"
] ]
}, },
"execution_count": 64, "execution_count": 65,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1712,7 +1725,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 65, "execution_count": 66,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1723,7 +1736,7 @@
" [ 8, 9, 10, 11]])" " [ 8, 9, 10, 11]])"
] ]
}, },
"execution_count": 65, "execution_count": 66,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1735,7 +1748,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 66, "execution_count": 67,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1744,7 +1757,7 @@
"array([ 8, 9, 10, 11])" "array([ 8, 9, 10, 11])"
] ]
}, },
"execution_count": 66, "execution_count": 67,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1755,7 +1768,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 67, "execution_count": 68,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1764,7 +1777,7 @@
"9" "9"
] ]
}, },
"execution_count": 67, "execution_count": 68,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1775,7 +1788,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 68, "execution_count": 69,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1784,7 +1797,7 @@
"array([1, 5, 9])" "array([1, 5, 9])"
] ]
}, },
"execution_count": 68, "execution_count": 69,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1795,7 +1808,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 69, "execution_count": 70,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1807,7 +1820,7 @@
" [ 3, 7, 11]])" " [ 3, 7, 11]])"
] ]
}, },
"execution_count": 69, "execution_count": 70,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1825,7 +1838,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 70, "execution_count": 71,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1836,7 +1849,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 71, "execution_count": 72,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1845,7 +1858,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 72, "execution_count": 73,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1854,7 +1867,7 @@
"array([0.29150425, 0.33893554, 0.08112756])" "array([0.29150425, 0.33893554, 0.08112756])"
] ]
}, },
"execution_count": 72, "execution_count": 73,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1865,7 +1878,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 73, "execution_count": 74,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1874,7 +1887,7 @@
"array([0.14575213, 0.16946777, 0.04056378])" "array([0.14575213, 0.16946777, 0.04056378])"
] ]
}, },
"execution_count": 73, "execution_count": 74,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1886,16 +1899,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 74, "execution_count": 75,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"0.0065746790060075" "0.00606649300607387"
] ]
}, },
"execution_count": 74, "execution_count": 75,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1908,7 +1921,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 75, "execution_count": 76,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1919,7 +1932,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 76, "execution_count": 77,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1928,7 +1941,7 @@
"memmap([0.29150425, 0.33893554, 0.08112756])" "memmap([0.29150425, 0.33893554, 0.08112756])"
] ]
}, },
"execution_count": 76, "execution_count": 77,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1953,7 +1966,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 77, "execution_count": 78,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1962,7 +1975,7 @@
"deque([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])" "deque([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])"
] ]
}, },
"execution_count": 77, "execution_count": 78,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1976,7 +1989,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 78, "execution_count": 79,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1985,7 +1998,7 @@
"deque([7, 8, 9, 0, 1, 2, 3, 4, 5, 6])" "deque([7, 8, 9, 0, 1, 2, 3, 4, 5, 6])"
] ]
}, },
"execution_count": 78, "execution_count": 79,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1997,7 +2010,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 79, "execution_count": 80,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -2006,7 +2019,7 @@
"deque([1, 2, 3, 4, 5, 6, 7, 8, 9, 0])" "deque([1, 2, 3, 4, 5, 6, 7, 8, 9, 0])"
] ]
}, },
"execution_count": 79, "execution_count": 80,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -2018,7 +2031,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 80, "execution_count": 81,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -2027,7 +2040,7 @@
"deque([-1, 1, 2, 3, 4, 5, 6, 7, 8, 9])" "deque([-1, 1, 2, 3, 4, 5, 6, 7, 8, 9])"
] ]
}, },
"execution_count": 80, "execution_count": 81,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -2039,7 +2052,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 81, "execution_count": 82,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -2048,7 +2061,7 @@
"deque([3, 4, 5, 6, 7, 8, 9, 11, 22, 33])" "deque([3, 4, 5, 6, 7, 8, 9, 11, 22, 33])"
] ]
}, },
"execution_count": 81, "execution_count": 82,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -2060,7 +2073,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 82, "execution_count": 83,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -2069,7 +2082,7 @@
"deque([40, 30, 20, 10, 3, 4, 5, 6, 7, 8])" "deque([40, 30, 20, 10, 3, 4, 5, 6, 7, 8])"
] ]
}, },
"execution_count": 82, "execution_count": 83,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -2095,7 +2108,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 83, "execution_count": 84,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -2104,7 +2117,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 84, "execution_count": 85,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -2131,7 +2144,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 85, "execution_count": 86,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -2140,7 +2153,7 @@
"[0, '1', 5, 6, '9', 14, 19, '23', 28, '28']" "[0, '1', 5, 6, '9', 14, 19, '23', 28, '28']"
] ]
}, },
"execution_count": 85, "execution_count": 86,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -2153,7 +2166,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 86, "execution_count": 87,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -2162,7 +2175,7 @@
"[0, '1', 14, 19, '23', 28, '28', 5, 6, '9']" "[0, '1', 14, 19, '23', 28, '28', 5, 6, '9']"
] ]
}, },
"execution_count": 86, "execution_count": 87,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }