From d425cdeef29aaf8e2948106462eea79eb262543a Mon Sep 17 00:00:00 2001 From: Mihai <M.Lefter@lumc.nl> Date: Sat, 16 Sep 2017 19:31:09 +0200 Subject: [PATCH] Introduction update to types. --- .../02_introduction_to_python_1.ipynb | 54 +++++++++++-------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/introduction/02_introduction_to_python_1.ipynb b/introduction/02_introduction_to_python_1.ipynb index 3ba28f0..9d8504f 100644 --- a/introduction/02_introduction_to_python_1.ipynb +++ b/introduction/02_introduction_to_python_1.ipynb @@ -396,6 +396,13 @@ "35 / 5" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Division is a bit weird: if you give it integer arguments, the result will also be an integer." + ] + }, { "cell_type": "code", "execution_count": 8, @@ -416,13 +423,6 @@ "36 / 5" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Division is a bit weird: if you give it integer arguments, the result will also be an integer." - ] - }, { "cell_type": "markdown", "metadata": { @@ -598,15 +598,12 @@ "cell_type": "markdown", "metadata": { "slideshow": { - "slide_type": "subslide" + "slide_type": "slide" } }, "source": [ - "Python as a calculator\n", - "===\n", - "\n", "Variables\n", - "---\n", + "===\n", "\n", "* We can use names to reference values (variables).\n", "* No need to declare them first or define the type." @@ -671,7 +668,7 @@ } }, "source": [ - "Python's type system (1/3)\n", + "Python's type system (1/4)\n", "===\n", "\n", "Every value has a type, view it using `type`:" @@ -739,8 +736,15 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, "source": [ + "Python's type system (2/4)\n", + "===\n", + "\n", "Another example of a builtin datatype is `str`, we'll see more later:" ] }, @@ -768,13 +772,10 @@ "cell_type": "markdown", "metadata": { "slideshow": { - "slide_type": "subslide" + "slide_type": "-" } }, "source": [ - "Python's type system (2/3)\n", - "===\n", - "\n", "Some operations are defined on more than one type, possibly with different meanings." ] }, @@ -800,8 +801,15 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, "source": [ + "Python's type system (3/4)\n", + "===\n", + "\n", "Dynamic typing means that variables can be assigned values of different types during runtime." ] }, @@ -874,7 +882,7 @@ } }, "source": [ - "Python's type system (2/3)\n", + "Python's type system (4/4)\n", "===\n", "\n", "Python is strongly typed, meaning that operations on values with incompatible types are forbidden." @@ -928,7 +936,7 @@ " <li>What is your average speed in miles per hour?</li>\n", " </ul>\n", " </li>\n", - " <li>Use string operations to reference string 'tra la la la' in a variable named *song*.</li>\n", + " <li>Use string operations to reference string 'tra la la la' in a variable named <i>song</i>.</li>\n", " <li>If an article costs 249 Euros including the 19% Value Added Tax (VAT), what is the actual VAT amount in Euros for the corresponding article?</li>\n", "</ol>\n", "\n", @@ -973,7 +981,7 @@ "</style>" ], "text/plain": [ - "<IPython.core.display.HTML at 0x3463a50>" + "<IPython.core.display.HTML object>" ] }, "execution_count": 1, @@ -984,7 +992,7 @@ "source": [ "from IPython.display import HTML\n", "def css_styling():\n", - " styles = open('styles/custom.css', 'r').read()\n", + " styles = open('../styles/custom.css', 'r').read()\n", " return HTML('<style>' + styles + '</style>')\n", "css_styling()" ] -- GitLab