"Read more in the reference (menu: Help <span class=\"fa-chevron-right fa\"></span> Markdown Reference)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Python cells\n",
"\n",
"You can enter code in these cells, and running the cell runs the corresponding code."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Hello world!\n"
]
}
],
"source": [
"print(\"Hello world!\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Example\n",
"\n",
"Execute the cell below to see the contents of variable `a`"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[ 0 1 -5]\n"
]
}
],
"source": [
"import numpy as np\n",
"\n",
"a = np.array([0, 1, -5])\n",
"print(a)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
" Copyright (c) 2024, Institute of Automatic Control - RWTH Aachen University\n",
" All rights reserved. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Tasks\n",
"The goal of the following tasks is to make you familiar with the JupyterLab user interface.\n",
"\n",
"## Task 1 - Getting to know JupyterLab and Notebooks\n",
"* Restart the kernel and run the whole notebook.\n",
"* Add a new Code Cell below with the following lines:\n",
" ```python\n",
" b = 1.5 * a\n",
" b\n",
" ```\n",
"* The notebook will always output the return value of the last line - collapse / hide the output.\n",
"* Markdown cells are a good way to document your thoughts - add a markdown cell above the last cell and describe the calculation.\n",
"* Open the *JupyterLab reference* and find the *The JupyterLab Interface* section.\n",
"\n",
"## Task 2 - Working with cells\n",
"* Notebooks are **stateful** - this means that it saves the value of variables in a global scope until the kernel is restarted. Thus, the order of execution matters.\n",
" * Have a look at the *Notebooks* section in the *JupyterLab reference*.\n",
" * Drag & drop the cell containingcalculation of `b` to the top of the notebook and run the whole notebook without restarting the kernel.\n",
" * Now restart the kernel and run the whole notebook.\n",
" * What happened? Fix the error by moving the calculation of `b` to an appropriate place.\n"
Read more in the reference (menu: Help <spanclass="fa-chevron-right fa"></span> Markdown Reference).
%% Cell type:markdown id: tags:
### Python cells
You can enter code in these cells, and running the cell runs the corresponding code.
%% Cell type:code id: tags:
``` python
print("Hello world!")
```
%% Output
Hello world!
%% Cell type:markdown id: tags:
#### Example
Execute the cell below to see the contents of variable `a`
%% Cell type:code id: tags:
``` python
importnumpyasnp
a=np.array([0,1,-5])
print(a)
```
%% Output
[ 0 1 -5]
%% Cell type:markdown id: tags:
Copyright (c) 2024, Institute of Automatic Control - RWTH Aachen University
All rights reserved.
%% Cell type:markdown id: tags:
# Tasks
The goal of the following tasks is to make you familiar with the JupyterLab user interface.
## Task 1 - Getting to know JupyterLab and Notebooks
* Restart the kernel and run the whole notebook.
* Add a new Code Cell below with the following lines:
```python
b=1.5*a
b
```
* The notebook will always output the return value of the last line - collapse / hide the output.
* Markdown cells are a good way to document your thoughts - add a markdown cell above the last cell and describe the calculation.
* Open the *JupyterLab reference* and find the *The JupyterLab Interface* section.
## Task 2 - Working with cells
* Notebooks are **stateful** - this means that it saves the value of variables in a global scope until the kernel is restarted. Thus, the order of execution matters.
* Have a look at the *Notebooks* section in the *JupyterLab reference*.
* Drag & drop the cell containingcalculation of `b` to the top of the notebook and run the whole notebook without restarting the kernel.
* Now restart the kernel and run the whole notebook.
* What happened? Fix the error by moving the calculation of `b` to an appropriate place.