Skip to content

Commit 849e49e

Browse files
committed
updates after first lecture
1 parent d9623ac commit 849e49e

File tree

4 files changed

+116
-14
lines changed

4 files changed

+116
-14
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
venv/
2-
.venv/
2+
.venv/
3+
TODOs.md

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,10 @@ You can either decide to use [notebook](https://realpython.com/jupyter-notebook-
7878
**List of notebooks**
7979
| file | topic |
8080
|:---|---|
81-
|*0_ipynb_introduction.ipynb*| Introduction to notebooks and Native Python data structures |
81+
|*0_ipynb_introduction.ipynb*| Introduction to notebooks|
8282
|*1_native_python_data_structures.ipynb*| Introduction to native Python data structures |
83-
|*2_numpy.ipynb*| NumPy arrays |
84-
|*3_pandas.ipynb*| Pandas Dataframes |
85-
|*4_introduction_to_images.ipynb*| Image data introduction |
83+
|*2_python_operators.ipynb*| python operators |
84+
|*3_numpy.ipynb*| NumPy arrays |
85+
|*4_pandas.ipynb*| Pandas Dataframes |
86+
|*5_introduction_to_images.ipynb*| Image data introduction |
8687

notebooks/0_ipynb_introduction.ipynb

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"© Mirko Piani - *PhD student in Precision Orchard Management (POM), university of Bologna (IT)*\\\n",
7+
"© Mirko Piani - *PhD student in Precision Orchard Management (POM), university of Bologna (IT)*\n",
88
"___\n",
99
"\n",
1010
"If you are having problems with the notebook, contact me at mirko.piani2@unibo.it"
@@ -42,6 +42,8 @@
4242
"source": [
4343
"+ To ***add a New Markdown cell Below*** the cell you are actually running, ***press*** ***B*** (= add bottom), then ***M*** (= markdown) \n",
4444
"+ To ***add a New Markdown cell Above*** the cell you are actually running, ***press*** ***A*** (= add above), then ***M*** (= markdown) \n",
45+
"+ To ***delete a Markdown cell***, select the cell and, ***press*** ***twice D*** = DD) \n",
46+
"\n",
4547
"\n",
4648
"\n",
4749
"**To write** inside a Markdown cell, select it and press *ENTER*.\\\n",
@@ -105,9 +107,9 @@
105107
"cell_type": "markdown",
106108
"metadata": {},
107109
"source": [
108-
"- To write *italic* text, include the text between single asteriks (i.e., \\*text\\*) or select the text and press CTRL + I\n",
109-
"- To write **bold** text, include the text between double asteriks (i.e., \\*\\*text\\*\\*) or select the text and press CTRL + B\n",
110-
"- To write ***italic-bold*** text, include the text between triple asteriks (i.e., \\*\\*\\*text\\*\\*\\*) or select the text and press CTRL + I, then CTRL + B"
110+
"- To write *italic* text, include the text between single asteriks (i.e., \\*text\\*) - or select the text and press CTRL + I if using LINUX\n",
111+
"- To write **bold** text, include the text between double asteriks (i.e., \\*\\*text\\*\\*) - or select the text and press CTRL + B if using LINUX\n",
112+
"- To write ***italic-bold*** text, include the text between triple asteriks (i.e., \\*\\*\\*text\\*\\*\\*) - or select the text and press CTRL + I, then CTRL + B if using LINUX"
111113
]
112114
},
113115
{
@@ -150,8 +152,17 @@
150152
"source": [
151153
"+ To ***add a New Code cell Below*** the cell you are actually running, ***press*** ***B*** (= add bottom)\n",
152154
"+ To ***add a New Code cell Above*** the cell you are actually running, ***press*** ***A*** (= add above) \n",
155+
"+ To ***delete a Code cell***, select the cell and, ***press*** ***twice D*** (= DD) \n",
153156
"\n",
154-
"\n",
157+
"> **Note**: \n",
158+
"> - to convert a markdown cell into a code cell, select the cell then press `Y`,\n",
159+
"> - to convert a code cell into a markdown cell, select the cell then press `M`."
160+
]
161+
},
162+
{
163+
"cell_type": "markdown",
164+
"metadata": {},
165+
"source": [
155166
"**To write** inside a code cell, select it and press *ENTER*.\\\n",
156167
"**After writing the code**, to run the code press *CTRL + ENTER*\n",
157168
"\n",
@@ -203,15 +214,15 @@
203214
"name": "stdout",
204215
"output_type": "stream",
205216
"text": [
206-
"1\n"
217+
"Hello World!\n"
207218
]
208219
}
209220
],
210221
"source": [
211222
"# this is a code comment\n",
212-
"a = 1 # this creates a variable named \"a\" with a value of 1\n",
223+
"my_variable = 'Hello World!' # this creates a variable named \"my_variable\"\n",
213224
"\n",
214-
"print(f'The value of the variable is {a}') # this prints the f-string"
225+
"print(f'{my_variable}') # this prints the f-string"
215226
]
216227
}
217228
],

notebooks/1_native_python_data_structures.ipynb

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"© Mirko Piani - *PhD student in Precision Orchard Management (POM), university of Bologna (IT)*\\\n",
7+
"© Mirko Piani - *PhD student in Precision Orchard Management (POM), university of Bologna (IT)*\n",
88
"___\n",
99
"\n",
1010
"If you are having problems with the notebook, contact me at mirko.piani2@unibo.it"
@@ -27,6 +27,7 @@
2727
"+ `str` - string\n",
2828
"+ `int` - integer number\n",
2929
"+ `float` - floating number\n",
30+
"+ `bool` - boolean\n",
3031
"+ native data structures\n",
3132
"+ non native data structures"
3233
]
@@ -354,6 +355,94 @@
354355
"</center>"
355356
]
356357
},
358+
{
359+
"cell_type": "markdown",
360+
"metadata": {},
361+
"source": [
362+
"# Bool"
363+
]
364+
},
365+
{
366+
"cell_type": "markdown",
367+
"metadata": {},
368+
"source": [
369+
"Booleans are `True`, `False` or 0 and 1"
370+
]
371+
},
372+
{
373+
"cell_type": "code",
374+
"execution_count": 1,
375+
"metadata": {},
376+
"outputs": [
377+
{
378+
"name": "stdout",
379+
"output_type": "stream",
380+
"text": [
381+
"<class 'bool'>\n"
382+
]
383+
}
384+
],
385+
"source": [
386+
"bool_variable = True\n",
387+
"print(type(bool_variable))"
388+
]
389+
},
390+
{
391+
"cell_type": "markdown",
392+
"metadata": {},
393+
"source": [
394+
"*AND*"
395+
]
396+
},
397+
{
398+
"cell_type": "code",
399+
"execution_count": 3,
400+
"metadata": {},
401+
"outputs": [
402+
{
403+
"name": "stdout",
404+
"output_type": "stream",
405+
"text": [
406+
"False\n",
407+
"True\n",
408+
"False\n"
409+
]
410+
}
411+
],
412+
"source": [
413+
"print(True and False)\n",
414+
"print(True and True)\n",
415+
"print(False and False)"
416+
]
417+
},
418+
{
419+
"cell_type": "markdown",
420+
"metadata": {},
421+
"source": [
422+
"*OR*"
423+
]
424+
},
425+
{
426+
"cell_type": "code",
427+
"execution_count": 4,
428+
"metadata": {},
429+
"outputs": [
430+
{
431+
"name": "stdout",
432+
"output_type": "stream",
433+
"text": [
434+
"True\n",
435+
"True\n",
436+
"False\n"
437+
]
438+
}
439+
],
440+
"source": [
441+
"print(True or False)\n",
442+
"print(True or True)\n",
443+
"print(False or False)"
444+
]
445+
},
357446
{
358447
"cell_type": "markdown",
359448
"metadata": {},

0 commit comments

Comments
 (0)