From: Neil Smith Date: Fri, 28 Sep 2018 14:21:21 +0000 (+0100) Subject: Rerun notebooks with output X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=5fcd6565317ea77d297bf3c6a349754f9bbd94cf;p=summerofcode2018soln.git Rerun notebooks with output --- diff --git a/src/task5/task5-nore.ipynb b/src/task5/task5-nore.ipynb index 0d215fd..d40bec6 100644 --- a/src/task5/task5-nore.ipynb +++ b/src/task5/task5-nore.ipynb @@ -61,14 +61,14 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 15, "metadata": {}, "outputs": [], "source": [ "def expand_no_re(text, expansion_limit=None):\n", " i = 1\n", " s, e, l, n = find_expansion_mark(text)\n", - " while s and (expansion_limit is None or (expansion_limit is not None and i <= expansion_limit)):\n", + " while s is not None and (expansion_limit is None or (expansion_limit is not None and i <= expansion_limit)):\n", " text = text[:s-l] + text[s-l:s] * n + text[e+1:]\n", " s, e, l, n = find_expansion_mark(text)\n", " i += 1\n", @@ -77,7 +77,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 16, "metadata": {}, "outputs": [], "source": [ @@ -86,7 +86,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 17, "metadata": {}, "outputs": [], "source": [ @@ -96,7 +96,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 18, "metadata": {}, "outputs": [ { @@ -105,7 +105,7 @@ "149043" ] }, - "execution_count": 8, + "execution_count": 18, "metadata": {}, "output_type": "execute_result" } @@ -116,7 +116,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -125,7 +125,7 @@ "302266" ] }, - "execution_count": 9, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } diff --git a/src/task5/task5-re.ipynb b/src/task5/task5-re.ipynb index fc14587..d7832e3 100644 --- a/src/task5/task5-re.ipynb +++ b/src/task5/task5-re.ipynb @@ -16,13 +16,13 @@ "metadata": {}, "outputs": [], "source": [ - "comment_mark = re.compile('<[^>]*>')\n", - "expand_mark = re.compile(':(\\d+):(\\d+):')" + "comment_mark = re.compile('<[^>]*>') # A < followed by some things that aren't > followed by >\n", + "expand_mark = re.compile(':(\\d+):(\\d+):') # A : followed by some digits, followed by another :, then some more digits, then a final :" ] }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -38,7 +38,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -60,7 +60,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -69,7 +69,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -79,7 +79,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -88,7 +88,7 @@ "149043" ] }, - "execution_count": 31, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -99,7 +99,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -108,7 +108,7 @@ "302266" ] }, - "execution_count": 32, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -119,7 +119,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ @@ -130,7 +130,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -139,7 +139,7 @@ "149043" ] }, - "execution_count": 34, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } @@ -150,7 +150,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -159,7 +159,7 @@ "302266" ] }, - "execution_count": 35, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -170,14 +170,14 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 12, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "27.5 ms ± 951 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n" + "27.7 ms ± 908 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n" ] } ], @@ -189,14 +189,14 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "875 ms ± 5.02 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" + "861 ms ± 7.25 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" ] } ],