Add video and streamline content

This commit is contained in:
Alexander Hess 2020-03-30 05:30:09 +02:00
parent c1268172d0
commit 0151478bae
3 changed files with 866 additions and 464 deletions

File diff suppressed because one or more lines are too long

View file

@ -19,7 +19,9 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"Read [Chapter 3](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/03_conditionals_00_lecture.ipynb) of the book. Then, work through the questions below." "The questions below assume that you have read [Chapter 3](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/03_conditionals_00_lecture.ipynb) in the book.\n",
"\n",
"Be concise in your answers! Most questions can be answered in *one* sentence."
] ]
}, },
{ {
@ -29,13 +31,6 @@
"### Essay Questions " "### Essay Questions "
] ]
}, },
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Answer the following questions *briefly*!"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
@ -47,7 +42,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
" " " < your answer >"
] ]
}, },
{ {
@ -61,7 +56,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
" " " < your answer >"
] ]
}, },
{ {
@ -75,7 +70,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
" " " < your answer >"
] ]
}, },
{ {
@ -89,7 +84,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
" " " < your answer >"
] ]
}, },
{ {
@ -103,7 +98,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
" " " < your answer >"
] ]
}, },
{ {
@ -129,7 +124,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
" " " < your answer >"
] ]
}, },
{ {
@ -159,7 +154,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
" " " < your answer >"
] ]
}, },
{ {
@ -173,7 +168,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
" " " < your answer >"
] ]
} }
], ],

View file

@ -19,7 +19,9 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"Read [Chapter 3](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/03_conditionals_00_lecture.ipynb) of the book. Then, work through the exercises below. The `...` indicate where you need to fill in your answers. You should not need to create any additional code cells." "The exercises below assume that you have read [Chapter 3](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/03_conditionals_00_lecture.ipynb) in the book.\n",
"\n",
"The `...`'s in the code cells indicate where you need to fill in code snippets. The number of `...`'s within a code cell give you a rough idea of how many lines of code are needed to solve the task. You should not need to create any additional code cells for your final solution. However, you may want to use temporary code cells to try out some ideas."
] ]
}, },
{ {
@ -49,8 +51,28 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"def discounted_price(...):\n", "def discounted_price(unit_price, quantity):\n",
" ..." " \"\"\"Calculate the price of a line item in an order.\n",
"\n",
" Args:\n",
" unit_price (float): price of one ordered item\n",
" quantity (int): number of items ordered\n",
"\n",
" Returns:\n",
" line_item_price (float)\n",
" \"\"\"\n",
" ...\n",
" ...\n",
" ...\n",
" ...\n",
"\n",
" ...\n",
" ...\n",
" ...\n",
" ...\n",
" ...\n",
"\n",
" return ..."
] ]
}, },
{ {
@ -143,7 +165,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
" " " < your answer >"
] ]
}, },
{ {
@ -182,9 +204,9 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"**Q2.2**: Loop over the `numbers` list and replace numbers for which one of the two (or both) conditions apply with text strings `\"Fizz\"`, `\"Buzz\"`, or `\"FizzBuzz\"` using the indexing operator `[]` and the assignment statement `=`.\n", "**Q2.2**: Loop over the `numbers` list and *replace* numbers for which one of the two (or both) conditions apply with text strings `\"Fizz\"`, `\"Buzz\"`, or `\"FizzBuzz\"` using the indexing operator `[]` and the assignment statement `=`.\n",
"\n", "\n",
"In [Chapter 1](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/01_elements_00_lecture.ipynb), we saw that Python starts indexing with `0` as the first element. Keep that in mind.\n", "In [Chapter 1](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/01_elements_00_lecture.ipynb#Who-am-I?-And-how-many?), we saw that Python starts indexing with `0` as the first element. Keep that in mind.\n",
"\n", "\n",
"So in each iteration of the `for`-loop, you have to determine an `index` variable as well as check the actual `number` for its divisors.\n", "So in each iteration of the `for`-loop, you have to determine an `index` variable as well as check the actual `number` for its divisors.\n",
"\n", "\n",
@ -198,6 +220,13 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"for number in numbers:\n", "for number in numbers:\n",
" ...\n",
"\n",
" ...\n",
" ...\n",
" ...\n",
" ...\n",
" ...\n",
" ..." " ..."
] ]
}, },