diff --git a/introduction/02_introduction_to_python_3.ipynb b/introduction/02_introduction_to_python_3.ipynb index 53cc781e5ade3ba67a9c84f7c83b856c90bba1e7..5c02472834e9838edbf659c0680c02f71a36e576 100644 --- a/introduction/02_introduction_to_python_3.ipynb +++ b/introduction/02_introduction_to_python_3.ipynb @@ -35,7 +35,9 @@ { "cell_type": "code", "execution_count": 1, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "def add_two(number):\n", @@ -84,7 +86,9 @@ { "cell_type": "code", "execution_count": 3, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "def add_some_other_number(number, other_number=12):\n", @@ -174,7 +178,9 @@ { "cell_type": "code", "execution_count": 7, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "def factorial(n):\n", @@ -344,40 +350,16 @@ } }, "source": [ - "$\\S$ Exercise: k-mer counting (1/2)\n", - "===\n", - "\n", - "Remember the previous exercise of finding (unique) substrings of length 3.\n", - "\n", - "* Make a function from your implementation.\n", - "* Have `k` as an argument to the function.\n", - "* Test the function on several input strings.\n", - "\n", - "**Note:** Editing multi-line statements in the console can be frustrating. You can try the QT console (`ipython qtconsole`) or edit your function in an editor with `%edit`:\n", - "\n", - " def my_function(arg):\n", - " print arg * 4\n", - " %edit my_function" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "$\\S$ Exercise: k-mer counting (2/2)\n", - "===\n", + "<div class=\"alert alert-success\">\n", + "<h1>Hands on!</h1>\n", "\n", - "Modify your function to use a dictionary with substring counts.\n", + "<ol>\n", + " <li>Write a Python function that returns the maximum of two numbers.</li>\n", + " <li>Write a Python function that returns the maximum of three numbers. Try to reuse the first maximum of two numbers function.</li>\n", + " <li>Write a Python function that accepts a string as parameter. Next, it calculates and prints the number of upper case letters and lower case letters. Make us of the `isupper` and `islower` built in methods.</li>\n", + "</ol>\n", "\n", - "* Use the substrings as dictionary keys.\n", - "* Use the counts as dictionary values.\n", - "* Have the function return the dictionary.\n", - "* Add a docstring to the function.\n", - "* Use the function to print k-mer counts for some strings." + "</div>" ] }, { @@ -708,7 +690,9 @@ { "cell_type": "code", "execution_count": 23, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "%edit examples/fsquare.py" @@ -737,22 +721,6 @@ " b = a" ] }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, - "source": [ - "$\\S$ Exercise: Running code from a file\n", - "===\n", - "\n", - "* Save your k-mer counting code to a file `kmer_counting.py`.\n", - "* Include some code using it on an example string and printing the results.\n", - "* Run the code from the command line." - ] - }, { "cell_type": "markdown", "metadata": { @@ -789,6 +757,20 @@ " Series of articles providing a tour of the Python standard library through short examples." ] }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "Homework assignment\n", + "===\n", + "\n", + "https://classroom.github.com/a/QU2iPYKn" + ] + }, { "cell_type": "code", "execution_count": 1, @@ -867,21 +849,21 @@ "metadata": { "celltoolbar": "Slideshow", "kernelspec": { - "display_name": "Python 2", + "display_name": "Python 3", "language": "python", - "name": "python2" + "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", - "version": 2 + "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.12" + "pygments_lexer": "ipython3", + "version": "3.5.2" } }, "nbformat": 4,