Skip to content

Commit

Permalink
sync up with the new python class versions
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale committed May 13, 2024
1 parent d4b4815 commit 5fdc24f
Show file tree
Hide file tree
Showing 5 changed files with 265 additions and 202 deletions.
46 changes: 37 additions & 9 deletions content/01-python-basics/jupyter.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,26 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-danger\">\n",
" \n",
"**Important**: when you work through a notebook, everything you did in previous cells is still in memory and _known_ by python, so you can refer to functions and variables that were previously defined. Even if you go up to the top of a notebook and insert a cell, all the information done earlier in your notebook session is still defined -- it doesn't matter where physically you are in the notebook. If you want to reset things, you can use the options under the _Kernel_ menu.\n",
"</div>"
"```{warning}\n",
"When you work through a notebook, everything you did in previous cells is still in memory and _known_ by python, so you can refer to functions and variables that were previously defined. Even if you go up to the top of a notebook and insert a cell, all the information done earlier in your notebook session is still defined -- it doesn't matter where physically you are in the notebook. If you want to reset things, you can use the options under the _Kernel_ menu.\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-warning\">\n",
"````{admonition} Quick Exercise\n",
" \n",
"<span class=\"fa fa-flash\"></span> Quick Exercise:\n",
"\n",
"Create a new cell below this one. Make sure that it is a _code_ cell, and enter the following code and run it:\n",
" \n",
"```\n",
"\n",
" print(\"Hello, World\")\n",
" \n",
"```\n",
"</div>"
"\n",
"````"
]
},
{
Expand All @@ -102,6 +100,36 @@
"source": [
"print(1, 2, 3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Note that the default behavior in Jupyter is to print the return value from the last statement in a cell, so we don't need to `print` if we just want the value of something like:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"10"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a = 10\n",
"a"
]
}
],
"metadata": {
Expand All @@ -120,7 +148,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.9"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 5fdc24f

Please sign in to comment.