Make links look nice with images

- rename all *_00_lecture.ipynb files into *_00_content.ipynb
- add links to YouTube videos at the end of the chapters
- add links to mybinder for all chapters and exercises
- remove the old chapter 8 on mappings & sets
- update the README.md and make it look nicer
This commit is contained in:
Alexander Hess 2020-04-02 15:49:27 +02:00
commit e1a0dd7924
38 changed files with 5445 additions and 14063 deletions

View file

@ -1,5 +1,12 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Important**: Click on \"*Kernel*\" > \"*Restart Kernel and Run All*\" *after* finishing the exercises in [JupyterLab <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_jp.png\">](https://jupyterlab.readthedocs.io/en/stable/) (e.g., in the cloud on [MyBinder <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_mb.png\">](https://mybinder.org/v2/gh/webartifex/intro-to-python/master?urlpath=lab/tree/01_elements_02_exercises.ipynb)) to ensure that your solution runs top to bottom *without* any errors"
]
},
{
"cell_type": "markdown",
"metadata": {},
@ -18,7 +25,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The exercises below assume that you have read [Chapter 1](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/01_elements_00_lecture.ipynb) in the book.\n",
"The exercises below assume that you have read [Chapter 1 <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_nb.png\">](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/01_elements_00_content.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."
]
@ -34,7 +41,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"**Q1.1**: *Concatenate* `greeting` and `audience` below with the `+` operator and print out the resulting message `\"Hello World\"` with only *one* call of the built-in [print()](https://docs.python.org/3/library/functions.html#print) function!\n",
"**Q1.1**: *Concatenate* `greeting` and `audience` below with the `+` operator and print out the resulting message `\"Hello World\"` with only *one* call of the built-in [print() <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_py.png\">](https://docs.python.org/3/library/functions.html#print) function!\n",
"\n",
"Hint: You may have to \"add\" a space character in between `greeting` and `audience`."
]
@ -76,9 +83,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"**Q1.3**: Read the documentation on the built-in [print()](https://docs.python.org/3/library/functions.html#print) function! How can you print the above message *without* concatenating `greeting` and `audience` first in *one* call of [print()](https://docs.python.org/3/library/functions.html#print)?\n",
"**Q1.3**: Read the documentation on the built-in [print() <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_py.png\">](https://docs.python.org/3/library/functions.html#print) function! How can you print the above message *without* concatenating `greeting` and `audience` first in *one* call of [print() <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_py.png\">](https://docs.python.org/3/library/functions.html#print)?\n",
"\n",
"Hint: The `*objects` in the documentation implies that we can put several *expressions* (i.e., variables) separated by commas within the same call of the [print()](https://docs.python.org/3/library/functions.html#print) function."
"Hint: The `*objects` in the documentation implies that we can put several *expressions* (i.e., variables) separated by commas within the same call of the [print() <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_py.png\">](https://docs.python.org/3/library/functions.html#print) function."
]
},
{
@ -108,7 +115,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"**Q1.5**: What does the `sep=\" \"` mean in the documentation on the built-in [print()](https://docs.python.org/3/library/functions.html#print) function? Adjust and use it to print out the three names referenced by `first`, `second`, and `third` on *one* line separated by *commas* with only *one* call of the [print()](https://docs.python.org/3/library/functions.html#print) function!"
"**Q1.5**: What does the `sep=\" \"` mean in the documentation on the built-in [print() <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_py.png\">](https://docs.python.org/3/library/functions.html#print) function? Adjust and use it to print out the three names referenced by `first`, `second`, and `third` on *one* line separated by *commas* with only *one* call of the [print() <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_py.png\">](https://docs.python.org/3/library/functions.html#print) function!"
]
},
{
@ -135,7 +142,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"**Q1.6**: Lastly, what does the `end=\"\\n\"` mean in the documentation? Adjust and use it within the `for`-loop to print the numbers `1` through `10` on *one* line with only *one* call of the [print()](https://docs.python.org/3/library/functions.html#print) function!"
"**Q1.6**: Lastly, what does the `end=\"\\n\"` mean in the documentation? Adjust and use it within the `for`-loop to print the numbers `1` through `10` on *one* line with only *one* call of the [print() <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_py.png\">](https://docs.python.org/3/library/functions.html#print) function!"
]
},
{
@ -159,7 +166,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The [volume of a sphere](https://en.wikipedia.org/wiki/Sphere) is defined as $\\frac{4}{3} * \\pi * r^3$.\n",
"The [volume of a sphere <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_wiki.png\">](https://en.wikipedia.org/wiki/Sphere) is defined as $\\frac{4}{3} * \\pi * r^3$.\n",
"\n",
"**Q2.1**: Calculate it for `r = 2.88` and approximate $\\pi$ with `pi = 3.14`!"
]
@ -284,7 +291,7 @@
"source": [
"`for`-loops are extremely versatile in Python. That is different from many other programming languages.\n",
"\n",
"As shown in the first example in [Chapter 1](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/01_elements_00_lecture.ipynb#Example:-Averaging-all-even-Numbers-in-a-List), we can create a `list` like `numbers` and loop over the numbers in it on a one-by-one basis."
"As shown in the first example in [Chapter 1 <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_nb.png\">](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/01_elements_00_content.ipynb#Example:-Averaging-all-even-Numbers-in-a-List), we can create a `list` like `numbers` and loop over the numbers in it on a one-by-one basis."
]
},
{
@ -300,7 +307,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"**Q3.1**: Fill in the *condition* of the `if` statement such that only numbers divisible by `3` are printed! Adjust the call of the [print()](https://docs.python.org/3/library/functions.html#print) function such that the `for`-loop prints out all the numbers on *one* line of output!"
"**Q3.1**: Fill in the *condition* of the `if` statement such that only numbers divisible by `3` are printed! Adjust the call of the [print() <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_py.png\">](https://docs.python.org/3/library/functions.html#print) function such that the `for`-loop prints out all the numbers on *one* line of output!"
]
},
{
@ -340,7 +347,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"An easy way to loop over a `list` object in a sorted manner, is to wrap it with the built-in [sorted()](https://docs.python.org/3/library/functions.html#sorted) function.\n",
"An easy way to loop over a `list` object in a sorted manner, is to wrap it with the built-in [sorted() <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_py.png\">](https://docs.python.org/3/library/functions.html#sorted) function.\n",
"\n",
"**Q3.3**: Fill in the condition of the `if` statement such that only odd numbers are printed out! Put all the numbers on *one* line of output!"
]
@ -360,11 +367,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Whenever we want to loop over numbers representing a [series](https://en.wikipedia.org/wiki/Series_%28mathematics%29) in the mathematical sense (i.e., a rule to calculate the next number from its predecessor), we may be able to use the [range()](https://docs.python.org/3/library/functions.html#func-range) built-in.\n",
"Whenever we want to loop over numbers representing a [series <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_wiki.png\">](https://en.wikipedia.org/wiki/Series_%28mathematics%29) in the mathematical sense (i.e., a rule to calculate the next number from its predecessor), we may be able to use the [range() <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_py.png\">](https://docs.python.org/3/library/functions.html#func-range) built-in.\n",
"\n",
"For example, to loop over the whole numbers from `0` to `9` (both including) in order, we could write them out in a `list` like below.\n",
"\n",
"**Q3.4**: Fill in the call to the [print()](https://docs.python.org/3/library/functions.html#print) function such that all the numbers are printed on *one* line ouf output!"
"**Q3.4**: Fill in the call to the [print() <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_py.png\">](https://docs.python.org/3/library/functions.html#print) function such that all the numbers are printed on *one* line ouf output!"
]
},
{
@ -381,7 +388,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"**Q3.5**: Read the documentation on the [range()](https://docs.python.org/3/library/functions.html#func-range) built-in! It may be used with either one, two, or three expressions \"passed\" in. What do `start`, `stop`, and `step` mean? Fill in the calls to [range()](https://docs.python.org/3/library/functions.html#func-range) and [print()](https://docs.python.org/3/library/functions.html#print) to mimic the output of **Q3.4**!"
"**Q3.5**: Read the documentation on the [range() <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_py.png\">](https://docs.python.org/3/library/functions.html#func-range) built-in! It may be used with either one, two, or three expressions \"passed\" in. What do `start`, `stop`, and `step` mean? Fill in the calls to [range() <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_py.png\">](https://docs.python.org/3/library/functions.html#func-range) and [print() <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_py.png\">](https://docs.python.org/3/library/functions.html#print) to mimic the output of **Q3.4**!"
]
},
{
@ -398,7 +405,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"**Q3.6**: Fill in the calls to [range()](https://docs.python.org/3/library/functions.html#func-range) and [print()](https://docs.python.org/3/library/functions.html#print) to print out *all* numbers from `1` to `10` (both including)!"
"**Q3.6**: Fill in the calls to [range() <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_py.png\">](https://docs.python.org/3/library/functions.html#func-range) and [print() <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_py.png\">](https://docs.python.org/3/library/functions.html#print) to print out *all* numbers from `1` to `10` (both including)!"
]
},
{
@ -415,7 +422,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"**Q3.7**: Fill in the calls to [range()](https://docs.python.org/3/library/functions.html#func-range) and [print()](https://docs.python.org/3/library/functions.html#print) to print out the *even* numbers from `1` to `10` (both including)! Do *not* use an `if` statement to accomplish this!"
"**Q3.7**: Fill in the calls to [range() <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_py.png\">](https://docs.python.org/3/library/functions.html#func-range) and [print() <img height=\"12\" style=\"display: inline-block\" src=\"static/link_to_py.png\">](https://docs.python.org/3/library/functions.html#print) to print out the *even* numbers from `1` to `10` (both including)! Do *not* use an `if` statement to accomplish this!"
]
},
{