Skip to content

Part 1 edits #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 19, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 113 additions & 29 deletions part-1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"name": "python2"
},
"name": "",
"signature": "sha256:0f359e9c97dbdab0051d127b9eec4d41334bcbfbb69469d54cd2d85bfab89255"
"signature": "sha256:5b78afa85dd8d13ddacbd2795e2e59031426989539554cff55ee4238d13cbf87"
},
"nbformat": 3,
"nbformat_minor": 0,
Expand Down Expand Up @@ -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."
]
},
{
Expand All @@ -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",
Expand Down Expand Up @@ -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."
]
},
{
Expand Down Expand Up @@ -245,7 +259,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"1 / 2"
"0.5/2"
],
"language": "python",
"metadata": {},
Expand All @@ -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": {},
Expand All @@ -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": {},
Expand All @@ -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": {},
Expand All @@ -312,7 +340,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"(1 + 3) * 4"
"x = 4"
],
"language": "python",
"metadata": {},
Expand All @@ -322,7 +350,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"x = 4"
"x * 3"
],
"language": "python",
"metadata": {},
Expand All @@ -332,7 +360,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"x * 3"
"_ + 8"
],
"language": "python",
"metadata": {},
Expand All @@ -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": {},
Expand All @@ -359,7 +407,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"cups_of_flour * .5"
"shirts = 1"
],
"language": "python",
"metadata": {},
Expand All @@ -369,7 +417,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"1 / 2\n"
"items_packed = jeans + shoes + socks + shirts"
],
"language": "python",
"metadata": {},
Expand All @@ -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": {},
Expand All @@ -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": {},
Expand All @@ -409,7 +469,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"type(1.0)"
"type(0.99)"
],
"language": "python",
"metadata": {},
Expand All @@ -426,7 +486,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"String data type"
"**String data type**"
]
},
{
Expand Down Expand Up @@ -459,6 +519,13 @@
"metadata": {},
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Concatenating strings**"
]
},
{
"cell_type": "code",
"collapsed": false,
Expand Down Expand Up @@ -493,6 +560,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"\"Carol \" + \"Willing\"\n"
],
"language": "python",
Expand Down Expand Up @@ -533,7 +601,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Tip - arrow up save typing"
"*Tip - arrow up to save time typing*"
]
},
{
Expand Down Expand Up @@ -636,6 +704,13 @@
"metadata": {},
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Quotes (single, double, triple)**"
]
},
{
"cell_type": "code",
"collapsed": false,
Expand Down Expand Up @@ -690,7 +765,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Printing - interactive vs file"
"**Displaying versus printing in IPython**"
]
},
{
Expand All @@ -717,7 +792,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Questions?"
"Questions? Quick review"
]
},
{
Expand Down Expand Up @@ -761,7 +836,8 @@
"outputs": []
},
{
"cell_type": "markdown",
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Make choices"
Expand Down Expand Up @@ -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": {},
Expand Down
Loading