diff --git a/part-1.ipynb b/part-1.ipynb index 5ecb901..dcb0461 100644 --- a/part-1.ipynb +++ b/part-1.ipynb @@ -10,7 +10,7 @@ "name": "python2" }, "name": "", - "signature": "sha256:0f359e9c97dbdab0051d127b9eec4d41334bcbfbb69469d54cd2d85bfab89255" + "signature": "sha256:5b78afa85dd8d13ddacbd2795e2e59031426989539554cff55ee4238d13cbf87" }, "nbformat": 3, "nbformat_minor": 0, @@ -52,11 +52,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "A programming community outreach workshop, brought to you by the generous volunteers from:\n", + "A programming community outreach workshop, brought to you by the generous volunteers and leadership from:\n", "\n", "- [PyLadies San Diego](www.meetup.com/sd-pyladies/)\n", "- [San Diego Python User Group](www.meetup.com/pythonsd/)\n", - "- [Inland Empire Pyladies](www.meetup.com/iepyladies/)" + "- [Inland Empire Pyladies](www.meetup.com/iepyladies/)\n", + "\n", + "Thanks to David and Kendall of SDPUG and Juliet of PyLadies SD for their support." ] }, { @@ -68,11 +70,13 @@ "- Danny\n", "- Rise\n", "- Trey\n", + "- Alain\n", + "- Micah\n", "- Jim\n", "- Others that are helping on day of event\n", "- Carol\n", "\n", - "Please take a moment to share 2-4 sentences about yourself\n", + "Please take a moment to share 2-4 sentences about yourself.\n", "\n", "We are all volunteers. If you enjoy this workshop and decide to continue with Python programming, we encourage you to volunteer at the next Intro to Python Workshop.\n", "\n", @@ -184,11 +188,21 @@ "Let's get started with the interactive lecture" ] }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Python as a Calculator" + ] + }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Terminal and start python" + "From your command prompt, type `python3` to enter IDLE.\n", + "\n", + "Some regular math operations." ] }, { @@ -245,7 +259,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "1 / 2" + "0.5/2" ], "language": "python", "metadata": {}, @@ -255,14 +269,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Whole number 1 divided by whole number 2" + "**Special type of division (floor)**" ] }, { "cell_type": "code", "collapsed": false, "input": [ - "3 / 2" + "3 // 2" ], "language": "python", "metadata": {}, @@ -272,17 +286,24 @@ "cell_type": "code", "collapsed": false, "input": [ - "15 / 2" + "15.5 // 2" ], "language": "python", "metadata": {}, "outputs": [] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Horizontal line spacing does not matter in Python in an individual statement. In a multiline program it does, you typically indent 4 spaces." + ] + }, { "cell_type": "code", "collapsed": false, "input": [ - "1.0 / 2" + "2 + 2" ], "language": "python", "metadata": {}, @@ -292,17 +313,24 @@ "cell_type": "code", "collapsed": false, "input": [ - "2 + 2" + "2+2" ], "language": "python", "metadata": {}, "outputs": [] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Parens and order of operations follow typical mathematics conventions in Python. `_` in IPython signifies the previous result." + ] + }, { "cell_type": "code", "collapsed": false, "input": [ - "2+2" + "(1 + 3) * 4" ], "language": "python", "metadata": {}, @@ -312,7 +340,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "(1 + 3) * 4" + "x = 4" ], "language": "python", "metadata": {}, @@ -322,7 +350,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "x = 4" + "x * 3" ], "language": "python", "metadata": {}, @@ -332,7 +360,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "x * 3" + "_ + 8" ], "language": "python", "metadata": {}, @@ -342,14 +370,34 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Variables" + "**A trip to PyCon**" ] }, { "cell_type": "code", "collapsed": false, "input": [ - "cups_of_flour = 5" + "jeans = 5" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "shoes = 2" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "socks = 12" ], "language": "python", "metadata": {}, @@ -359,7 +407,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "cups_of_flour * .5" + "shirts = 1" ], "language": "python", "metadata": {}, @@ -369,7 +417,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "1 / 2\n" + "items_packed = jeans + shoes + socks + shirts" ], "language": "python", "metadata": {}, @@ -379,7 +427,17 @@ "cell_type": "code", "collapsed": false, "input": [ - "1.0 / 2" + "items_packed" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print(items_packed)" ], "language": "python", "metadata": {}, @@ -389,17 +447,19 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Two different data types\n", + "**Using type() to find the datatype**\n", "\n", "\n", - "Let's use a function" + "Let's use a function. You'll be hearing more about functions later today. For now let's say that a function is like a Personal Assistant. You ask for a job to be done, and if you give the assistant the correct instructions, he will do the tasks asked.\n", + "\n", + "One handy thing that our Python Personal Assistant, aka Funky Function, can do is tell us a variable's current data type." ] }, { "cell_type": "code", "collapsed": false, "input": [ - "type(1)" + "type(shirts)" ], "language": "python", "metadata": {}, @@ -409,7 +469,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "type(1.0)" + "type(0.99)" ], "language": "python", "metadata": {}, @@ -426,7 +486,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "String data type" + "**String data type**" ] }, { @@ -459,6 +519,13 @@ "metadata": {}, "outputs": [] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Concatenating strings**" + ] + }, { "cell_type": "code", "collapsed": false, @@ -493,6 +560,7 @@ "cell_type": "code", "collapsed": false, "input": [ + "\n", "\"Carol \" + \"Willing\"\n" ], "language": "python", @@ -533,7 +601,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Tip - arrow up save typing" + "*Tip - arrow up to save time typing*" ] }, { @@ -636,6 +704,13 @@ "metadata": {}, "outputs": [] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Quotes (single, double, triple)**" + ] + }, { "cell_type": "code", "collapsed": false, @@ -690,7 +765,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Printing - interactive vs file" + "**Displaying versus printing in IPython**" ] }, { @@ -717,7 +792,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Questions?" + "Questions? Quick review" ] }, { @@ -761,7 +836,8 @@ "outputs": [] }, { - "cell_type": "markdown", + "cell_type": "heading", + "level": 3, "metadata": {}, "source": [ "Make choices" @@ -1137,6 +1213,14 @@ "metadata": {}, "outputs": [] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**Exiting the interpreter is a good thing to know.** \n", + "To exit, type `exit()` or press CNTL-D." + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/part-3.ipynb b/part-3.ipynb index ea1557c..e096533 100644 --- a/part-3.ipynb +++ b/part-3.ipynb @@ -522,6 +522,7 @@ "language": "python", "metadata": {}, "outputs": [] + }, { "cell_type": "heading", @@ -816,7 +817,8 @@ ], "language": "python", "metadata": {}, - "outputs": [] + "outputs": [], + "prompt_number": 8 }, { "cell_type": "markdown", @@ -833,7 +835,17 @@ ], "language": "python", "metadata": {}, - "outputs": [] + "outputs": [ + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 10, + "text": [ + "2" + ] + } + ], + "prompt_number": 10 }, { "cell_type": "markdown", @@ -854,7 +866,18 @@ ], "language": "python", "metadata": {}, - "outputs": [] + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "First die: 3\n", + "Second die: 3\n", + "You rolled a 6\n" + ] + } + ], + "prompt_number": 12 }, { "cell_type": "markdown", @@ -871,7 +894,17 @@ ], "language": "python", "metadata": {}, - "outputs": [] + "outputs": [ + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 13, + "text": [ + "'m'" + ] + } + ], + "prompt_number": 13 }, { "cell_type": "markdown", @@ -897,7 +930,8 @@ ], "language": "python", "metadata": {}, - "outputs": [] + "outputs": [], + "prompt_number": 14 }, { "cell_type": "markdown", @@ -914,7 +948,16 @@ ], "language": "python", "metadata": {}, - "outputs": [] + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Happy Birthday, dear Carol!\n" + ] + } + ], + "prompt_number": 20 }, { "cell_type": "markdown", @@ -933,6 +976,35 @@ ], "language": "python", "metadata": {}, + "outputs": [ + { + "html": [ + "\n", + " \n", + " " + ], + "metadata": {}, + "output_type": "pyout", + "prompt_number": 11, + "text": [ + "" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, "outputs": [] }, {