From e702c295b5d3b93ada57d29136053b47269fd759 Mon Sep 17 00:00:00 2001 From: Jonas Eschle Date: Tue, 5 Nov 2024 18:28:06 -0500 Subject: [PATCH] fix: multiple small fixes --- .gitignore | 5 ++++- .pre-commit-config.yaml | 8 ++++---- python/01basics.ipynb | 12 ++++++++++++ python/conditions.ipynb | 2 +- python/dictionaries.ipynb | 32 +++++++------------------------- python/lists.ipynb | 28 ++++++---------------------- python/numbers.ipynb | 12 ++---------- 7 files changed, 36 insertions(+), 63 deletions(-) diff --git a/.gitignore b/.gitignore index 11676a02..673554e4 100644 --- a/.gitignore +++ b/.gitignore @@ -3,9 +3,12 @@ _book/ node_modules/ *.pyc *.swp + book.pdf analysis-essentials.pdf shell/files/data-shell.zip build .ipynb_checkpoints -*~ \ No newline at end of file +*~ +/.idea + diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c60dfd19..ebdad874 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,8 +30,8 @@ repos: # needs rust, only activate if needed - - repo: https://github.com/shssoichiro/oxipng - rev: v9.1.2 - hooks: - - id: oxipng +# - repo: https://github.com/shssoichiro/oxipng +# rev: v9.1.2 +# hooks: +# - id: oxipng diff --git a/python/01basics.ipynb b/python/01basics.ipynb index f497d518..0db58235 100644 --- a/python/01basics.ipynb +++ b/python/01basics.ipynb @@ -56,6 +56,9 @@ "cell_type": "code", "execution_count": null, "metadata": { + "jupyter": { + "is_executing": true + }, "slideshow": { "slide_type": "subslide" } @@ -129,6 +132,9 @@ "cell_type": "code", "execution_count": null, "metadata": { + "jupyter": { + "is_executing": true + }, "slideshow": { "slide_type": "subslide" } @@ -155,6 +161,9 @@ "cell_type": "code", "execution_count": null, "metadata": { + "jupyter": { + "is_executing": true + }, "slideshow": { "slide_type": "subslide" } @@ -1266,6 +1275,9 @@ "cell_type": "code", "execution_count": null, "metadata": { + "jupyter": { + "is_executing": true + }, "slideshow": { "slide_type": "subslide" } diff --git a/python/conditions.ipynb b/python/conditions.ipynb index c50933a8..e4c4854e 100644 --- a/python/conditions.ipynb +++ b/python/conditions.ipynb @@ -356,7 +356,7 @@ "Find the double-underscore method on lists and dictionaries that corresponds to\n", "the `in` operator, and check that it does the same thing as the operator.\n", "\n", - "{% solution \"Solution\" %}\n", + "**Solutions**\n", "\n", "Taking lists as an example, the `dir` method can tell us what methods are\n", "available. The `__contains__` method sounds promising." diff --git a/python/dictionaries.ipynb b/python/dictionaries.ipynb index 69dc4a0f..1fd748c7 100644 --- a/python/dictionaries.ipynb +++ b/python/dictionaries.ipynb @@ -324,11 +324,9 @@ "cell_type": "code", "execution_count": null, "metadata": { - "editable": true, - "slideshow": { - "slide_type": "" - }, - "tags": [] + "tags": [ + "raises-exception" + ] }, "outputs": [], "source": [ @@ -336,16 +334,8 @@ ] }, { - "cell_type": "code", - "execution_count": null, - "metadata": { - "editable": true, - "slideshow": { - "slide_type": "" - }, - "tags": [] - }, - "outputs": [], + "cell_type": "markdown", + "metadata": {}, "source": [ "In essence, keys must not be mutable. This includes numbers, strings, and\n", "tuples, but not lists. This restriction is a trade-off that allows Python to\n", @@ -353,16 +343,8 @@ ] }, { - "cell_type": "code", - "execution_count": null, - "metadata": { - "editable": true, - "slideshow": { - "slide_type": "" - }, - "tags": [] - }, - "outputs": [], + "cell_type": "markdown", + "metadata": {}, "source": [ "**Advanced (skip on first read)**\n", "Immutable data types in Python have a `__hash__()` function, you can test it\n", diff --git a/python/lists.ipynb b/python/lists.ipynb index b9a03cd4..7c5545fb 100644 --- a/python/lists.ipynb +++ b/python/lists.ipynb @@ -603,16 +603,8 @@ ] }, { - "cell_type": "code", - "execution_count": null, - "metadata": { - "editable": true, - "slideshow": { - "slide_type": "" - }, - "tags": [] - }, - "outputs": [], + "cell_type": "markdown", + "metadata": {}, "source": [ "**Solution**\n", "You need to slice from the very beginning to the very end of the list." @@ -784,7 +776,7 @@ "outputs": [], "source": [ "for i in b:\n", - "print(i)" + " print(i)" ] }, { @@ -817,7 +809,7 @@ "outputs": [], "source": [ "for i in b:\n", - " print(\"I am in a loop\")\n", + " print(\"I am in a loop\")\n", " print(i)" ] }, @@ -1758,16 +1750,8 @@ ] }, { - "cell_type": "code", - "execution_count": null, - "metadata": { - "editable": true, - "slideshow": { - "slide_type": "" - }, - "tags": [] - }, - "outputs": [], + "cell_type": "markdown", + "metadata": {}, "source": [ "Each element of the list is a tuple." ] diff --git a/python/numbers.ipynb b/python/numbers.ipynb index 56572af3..153dba53 100644 --- a/python/numbers.ipynb +++ b/python/numbers.ipynb @@ -47,16 +47,8 @@ ] }, { - "cell_type": "code", - "execution_count": null, - "metadata": { - "editable": true, - "slideshow": { - "slide_type": "" - }, - "tags": [] - }, - "outputs": [], + "cell_type": "markdown", + "metadata": {}, "source": [ "Python also lets you manipulate complex numbers, using `j` to represent the \n", "complex term."