diff --git a/introduction/02_introduction_to_python_2.ipynb b/introduction/02_introduction_to_python_2.ipynb index 4ea943136d36ca5164fb6b75366ea3c10102ef6c..589da2e4b1d1dcb95eb27dd5995ae58f9feeec56 100644 --- a/introduction/02_introduction_to_python_2.ipynb +++ b/introduction/02_introduction_to_python_2.ipynb @@ -566,7 +566,9 @@ { "cell_type": "code", "execution_count": 20, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "l = [1, 2, 3, 4]\n", @@ -1198,7 +1200,9 @@ { "cell_type": "code", "execution_count": 43, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "if False:\n", @@ -1237,7 +1241,9 @@ { "cell_type": "code", "execution_count": 44, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "# Add 42 to this list.\n", @@ -1257,7 +1263,9 @@ { "cell_type": "code", "execution_count": 45, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "while False:\n", @@ -1319,7 +1327,9 @@ { "cell_type": "code", "execution_count": 47, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "range?" @@ -1417,7 +1427,9 @@ { "cell_type": "code", "execution_count": 51, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "colors = ['red', 'white', 'blue', 'orange']\n", @@ -1678,6 +1690,31 @@ "There are many more useful iterables in Python." ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "<div class=\"alert alert-success\">\n", + "<h1>Hands on!</h1>\n", + "\n", + "<ol>\n", + " <li>Make a list with 10 integer elements. Sum all the items in the list.</li>\n", + " <li>Make a new list from the above one that does not include the 0th, 4th and 5th elements.\n", + " <li>Sum only the elements from the first list which are between the 2nd and 6th elements.\n", + " <li>Make a new list that includes only the elements that are greater than 10 from the first list.\n", + " <li>Food.\n", + " <ul>\n", + " <li>Create a dictionary for food products called \"prices\" and put some values in it, e.g., \"apples\": 2, \"oranges\": 1.5, \"pears\": 3, ...</li>\n", + " <li>Create a corresponding dictionary called \"stocks\" and put the stock values in it, e.g., \"apples\": 0, \"oranges\": 1, \"pears\": 10, ...</li>\n", + " <li>Print stock and price information for each food item.</li>\n", + " <li>Determine and print how much money you would make if you sold all of your food products.\n", + " </ul>\n", + " </li>\n", + "</ol>\n", + "\n", + "</div>" + ] + }, { "cell_type": "markdown", "metadata": { @@ -1865,21 +1902,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,