update lecture as finished

This commit is contained in:
Andrew Straw 2024-10-25 06:36:44 +02:00
parent 8760d16881
commit b7869c9091
3 changed files with 351 additions and 63 deletions

View file

@ -23,6 +23,8 @@
"source": [
"## Who am I (what do I know about programming, data science, and bioinformatics)?\n",
"\n",
"We are interested in the neurobiology of navigation in insects. Recently, we have been working on tracking bees in nature. These are fascinating animals because they remember, with a tiny brain, how to get from home to flowers and back again. How do they do it?\n",
"\n",
"[strawlab.org](https://strawlab.org/)"
]
},
@ -79,7 +81,7 @@
"source": [
"## Assignments\n",
"\n",
"Around the time of each lecture, there will be a new assignment posted on Ilias. We expect that you should be able to finish the exercise by Monday at 18:00, but the exercises will be due Wednesday at 23:55. We use https://strawlab-rp2.zoologie.uni-freiburg.de to handle distributing and collecting work. This runs software called [forgejo](https://forgejo.org) which approximates other sites such as [GitHub](https://github.com) and is widely used in the software world."
"Around the time of each lecture, there will be a new assignment posted. We expect that you should be able to finish the exercise by Monday at 18:00, but the exercises will be due Wednesday at 23:55. We use https://strawlab-rp2.zoologie.uni-freiburg.de to handle distributing and collecting work. This runs software called [forgejo](https://forgejo.org) which approximates other sites such as [GitHub](https://github.com) and is widely used in the software world."
]
},
{

View file

@ -24,16 +24,16 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"# this is a comment"
"# this is a comment."
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
@ -49,16 +49,27 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"4"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
@ -67,9 +78,20 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"5"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a"
]
@ -78,7 +100,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Good practice - \"restart are run all\" in your notebooks\n",
"## Good practice - \"restart and run all\" in your notebooks\n",
"\n",
"It is good practice to \"Kernel -> restart and run all\" prior to finishing work on a Jupyter notebook. This ensures that your notebook can execute code from top to bottom, as it is displayed.\n",
"\n",
@ -89,7 +111,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 28,
"metadata": {
"nbgrader": {
"grade": true,

View file

@ -20,9 +20,17 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"hello world\n"
]
}
],
"source": [
"print(\"hello world\")"
]
@ -38,7 +46,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
@ -47,43 +55,81 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"hello world\n"
]
}
],
"source": [
"print(x)"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"x\n"
]
}
],
"source": [
"print(\"x\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"'hello world'"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"str"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"type(x)"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 33,
"metadata": {},
"outputs": [],
"source": [
@ -92,99 +138,208 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 35,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"42\n"
]
}
],
"source": [
"print(x)"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 37,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"42\n"
]
}
],
"source": [
"print(42)"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 39,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"42"
]
},
"execution_count": 39,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 41,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"int"
]
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"type(x)"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 43,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<built-in function print>\n"
]
}
],
"source": [
"print(print)"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 45,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"<function print(*args, sep=' ', end='\\n', file=None, flush=False)>"
]
},
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"print"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 47,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"builtin_function_or_method"
]
},
"execution_count": 47,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"type(print)"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 49,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'type'>\n"
]
}
],
"source": [
"print(type)"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 51,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"type"
]
},
"execution_count": 51,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"type"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 53,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"type"
]
},
"execution_count": 53,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"type(type)"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 55,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"type"
]
},
"execution_count": 55,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"type(type(x))"
]
@ -200,7 +355,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 57,
"metadata": {},
"outputs": [],
"source": [
@ -209,16 +364,27 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 59,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"'my new string'"
]
},
"execution_count": 59,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 61,
"metadata": {},
"outputs": [],
"source": [
@ -227,16 +393,27 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 63,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"-1"
]
},
"execution_count": 63,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 65,
"metadata": {},
"outputs": [],
"source": [
@ -245,9 +422,20 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 67,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 67,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x"
]
@ -296,32 +484,101 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 69,
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "ZeroDivisionError",
"evalue": "division by zero",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mZeroDivisionError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[69], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;241m1\u001b[39m\u001b[38;5;241m/\u001b[39m\u001b[38;5;241m0\u001b[39m\n",
"\u001b[0;31mZeroDivisionError\u001b[0m: division by zero"
]
}
],
"source": [
"1/0"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 71,
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "NameError",
"evalue": "name 'variable_does_not_exist' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[71], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m x \u001b[38;5;241m=\u001b[39m variable_does_not_exist \u001b[38;5;241m+\u001b[39m \u001b[38;5;241m4\u001b[39m\n",
"\u001b[0;31mNameError\u001b[0m: name 'variable_does_not_exist' is not defined"
]
}
],
"source": [
"x = variable_does_not_exist + 4"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 85,
"metadata": {
"tags": []
},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "invalid syntax (860949385.py, line 1)",
"output_type": "error",
"traceback": [
"\u001b[0;36m Cell \u001b[0;32mIn[85], line 1\u001b[0;36m\u001b[0m\n\u001b[0;31m defx asdlkfj39:\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
]
}
],
"source": [
"defx asdlkfj39:\n",
" adsk..{"
]
},
{
"cell_type": "code",
"execution_count": 81,
"metadata": {},
"outputs": [],
"source": [
"def asdlkfj39():\n",
" adsk"
]
},
{
"cell_type": "code",
"execution_count": 83,
"metadata": {
"tags": []
},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'adsk' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[83], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m asdlkfj39()\n",
"Cell \u001b[0;32mIn[81], line 2\u001b[0m, in \u001b[0;36masdlkfj39\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21masdlkfj39\u001b[39m():\n\u001b[0;32m----> 2\u001b[0m adsk\n",
"\u001b[0;31mNameError\u001b[0m: name 'adsk' is not defined"
]
}
],
"source": [
"asdlkfj39()"
]
},
{
"cell_type": "markdown",
"metadata": {},
@ -342,7 +599,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 87,
"metadata": {},
"outputs": [],
"source": [
@ -352,7 +609,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 89,
"metadata": {
"nbgrader": {
"grade": true,
@ -368,6 +625,13 @@
"source": [
"assert x==2"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {