Skip to content

Commit

Permalink
Updated notebooks for Spring 2021.
Browse files Browse the repository at this point in the history
  • Loading branch information
jtkiley committed Jan 18, 2021
1 parent 3b8cedc commit 6c29391
Show file tree
Hide file tree
Showing 12 changed files with 3,230 additions and 2,612 deletions.
163 changes: 107 additions & 56 deletions notebooks/0a_intro.ipynb

Large diffs are not rendered by default.

3,943 changes: 2,011 additions & 1,932 deletions notebooks/0b_anaconda.ipynb

Large diffs are not rendered by default.

135 changes: 129 additions & 6 deletions notebooks/1a_python1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"2020-01-12 15:08:41.567360\n"
"2021-01-18 17:31:51.092606\n"
]
}
],
Expand All @@ -530,9 +530,9 @@
"name": "stdout",
"output_type": "stream",
"text": [
"2020\n",
"2021\n",
"1\n",
"12\n"
"18\n"
]
}
],
Expand All @@ -552,7 +552,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"2019-01-12 15:08:41.567360\n"
"2020-01-19 17:31:51.092606\n"
]
}
],
Expand Down Expand Up @@ -831,7 +831,130 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Bonus topics\n",
"# Breakout Exercises\n",
"\n",
"Let's do a few exercises to reinforce the concepts we learned above.\n",
"\n",
"\n",
"1. ints and floats\n",
"1. strings\n",
"1. dictionaries"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## EX1: ints and floats\n",
"\n",
"This is fairly strightforward, so let's calculate two things.\n",
"\n",
"1. Subtract the number of doctoral students in your breakout room from the total number of participants.\n",
"1. Compute the proportion of doctoral students to total participants in your breakout room."
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [],
"source": [
"# 1-1 code\n"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [],
"source": [
"# 1-2 code\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## EX2: strings\n",
"\n",
"1. Create a string containing `Hello, World!` and assign it to the name `z_string`.\n",
"1. Take `z_string` and add (using `+`) the string ` I'm [yourname].` to it (filling in your name).\n",
"1. Display the original string, verifying that the last step didn't change it."
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [],
"source": [
"# 2-1 code\n"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [],
"source": [
"# 2-2 code\n"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"outputs": [],
"source": [
"# 2-3 code\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## EX3: dictionaries\n",
"\n",
"Dictionaries are usefful for a number of things, including as a lightweight way to represent a row of data.\n",
"When we use them this way, the keys are like column names, and the values are like the actual data.\n",
"\n",
"1. Assign `z_dict` to a dictionary with the key `'name'` and a value of the name of the breakout room member who is screen sharing.\n",
"1. Update the dictionary with another key `'affil'` and a value of the affiliation of the breakout room member who is screen sharing.\n",
"1. Use the indexing syntax to retrieve the value corresponding with the key `'affil'`."
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [],
"source": [
"# 3-1 code\n"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [],
"source": [
"# 3-2 code\n"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [],
"source": [
"# 3-3 code\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Bonus topics\n",
"\n",
"We won't cover these directly, but here are two other topics that are good to know.\n",
"\n",
Expand All @@ -858,7 +981,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.8.5"
}
},
"nbformat": 4,
Expand Down
98 changes: 92 additions & 6 deletions notebooks/1b_python2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,92 @@
"1. Finally, it resets the index column and drops the old index values."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Breakout Exercises\n",
"\n",
"Let's do two exercises to reinforce the concepts we learned above.\n",
"\n",
"\n",
"1. functions\n",
"1. loops"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## EX1: functions\n",
"\n",
"Let's make a function to do the temperature calculation in the other direction.\n",
"\n",
"1. Create a function named `c_to_f()` that takes a temerature in celsius and returns the temperature in fahrenheit. You may need to google the formula (I did).\n",
"1. Try your function by converting `100` from C to F."
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [],
"source": [
"# 1-1 code\n"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [],
"source": [
"# 1-2 code\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## EX2: loops\n",
"\n",
"Loops let us take a procedure and repeat it.\n",
"We'll use a `for` loop here to apply a simple computation.\n",
"\n",
"1. Create a list, named `x_list`, that contains the integers `1` through `5`.\n",
"1. Create a new list, named `y_list` where each element is `2` times the corresponding element in `x_list`. Use a `for` loop.\n",
"1. Create a new list, named `z_list`, that matches what you did for `y_list`, but use a list comprehension to construct it.\n",
"\n",
"**Note:** This is the first exercise where some cells will have multiple lines of code, but that will be the norm going forward."
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [],
"source": [
"# 2-1 code\n"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [],
"source": [
"# 2-2 code\n"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [],
"source": [
"# 2-3 code\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -970,7 +1056,7 @@
},
{
"cell_type": "code",
"execution_count": 42,
"execution_count": 47,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -979,7 +1065,7 @@
},
{
"cell_type": "code",
"execution_count": 43,
"execution_count": 48,
"metadata": {},
"outputs": [
{
Expand All @@ -988,7 +1074,7 @@
"array([ 0. , 22.22222222, 47.22222222])"
]
},
"execution_count": 43,
"execution_count": 48,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -999,7 +1085,7 @@
},
{
"cell_type": "code",
"execution_count": 44,
"execution_count": 49,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1169,7 +1255,7 @@
" 'view']"
]
},
"execution_count": 44,
"execution_count": 49,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -1195,7 +1281,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.8.5"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 6c29391

Please sign in to comment.