Skip to content

Commit 77cecdd

Browse files
author
nbgitpuller
committed
WIP
1 parent 2365646 commit 77cecdd

File tree

5 files changed

+36
-42
lines changed

5 files changed

+36
-42
lines changed

000_Welcome_on_Board.ipynb

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"cell_type": "markdown",
8989
"metadata": {},
9090
"source": [
91-
"In case that you have questions about the notebooks: "
91+
"In case that you have questions and comments about the notebooks: "
9292
]
9393
},
9494
{
@@ -171,7 +171,7 @@
171171
"source": [
172172
"<img align=\"left\" width=\"6%\" style=\"padding-right:10px;\" src=\"images/info.png\">\n",
173173
"\n",
174-
"Python has being constantly improved in the part years. These notebooks **only** use the latest version of the language: **Python 3**. The past version of the language, [**Python 2**](https://pythonclock.org/), will *retire* soon and no longer be maintained!"
174+
"Python has being constantly improved in the part years. These notebooks **only** use the latest version of the language: **Python 3**. The past version of the language, [**Python 2**](https://pythonclock.org/), will *retire* soon and no longer be maintained! Thus, when searching online for help, make sure the results refer to **Python 3**."
175175
]
176176
},
177177
{
@@ -576,14 +576,8 @@
576576
"cell_type": "markdown",
577577
"metadata": {},
578578
"source": [
579-
"Each time that you execute a **Code** cell in a notebook, the coding results are shown in its output section (e.g., the `Hello Python` text after the above **Code** cells)."
580-
]
581-
},
582-
{
583-
"cell_type": "markdown",
584-
"metadata": {},
585-
"source": [
586-
"If you want to clear all the coding results in a notebook, you may do so by clicking in the Menu bar: `Kernel/Restart and Clear Output` .\n",
579+
"Each time that you execute a **Code** cell in a notebook, the coding results are shown in its output section (e.g., the `Hello Python` text after the above **Code** cells).\n",
580+
"If you want to clear all the coding results in a notebook, you may do so by clicking in the Menu bar: `Kernel/Restart and Clear Output`.\n",
587581
"\n",
588582
"![How to clear a notebook](images/000_020_dashboard_restart_kernel_and_clear_output.png)"
589583
]

001_Variables_and_Types.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
"source": [
106106
"<img align=\"left\" width=\"6%\" style=\"padding-right:10px;\" src=\"images/info.png\">\n",
107107
"\n",
108-
"You do not need to specify the type of a variable when you create it. This fact makes Python a [dynamically-typed](dynamically_and_strongly_typed.ipynb) language. We will now explore what this means in practice!"
108+
"You do not need to specify the type of a variable when you create it. We will explore what this means in practice below! <br> If you want to learn more about Python as a dynamically-typed language, read [this supplemental notebook](dynamically_and_strongly_typed.ipynb). "
109109
]
110110
},
111111
{

002_Lists_of_Variables.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@
591591
"source": [
592592
"<img align=\"left\" width=\"6%\" style=\"padding-right:10px;\" src=\"images/info.png\">\n",
593593
"\n",
594-
"You will learn more about some of these magic methods in other [notebooks](008_First_Steps_of_a_Class.ipynb)."
594+
"You will learn more about some of these magic methods in later [notebooks](008_First_Steps_of_a_Class.ipynb)."
595595
]
596596
},
597597
{
@@ -764,8 +764,8 @@
764764
"source": [
765765
"<img align=\"left\" width=\"6%\" style=\"padding-right:10px;\" src=\"images/info.png\">\n",
766766
"\n",
767-
"A `list` implements all of the [common](https://docs.python.org/3.6/library/stdtypes.html?#typesseq-common) and [mutable sequence operations](https://docs.python.org/3.6/library/stdtypes.html?#mutable-sequence-types).\n",
768-
"If you are curious to know more about the methods available for a `list`, give a look to this [section](https://docs.python.org/3.6/library/stdtypes.html?highlight=list#lists) of the official Python documentation."
767+
"A `list` implements all of the so-called [*common*](https://docs.python.org/3.6/library/stdtypes.html?#typesseq-common) and [*mutable sequence operations*](https://docs.python.org/3.6/library/stdtypes.html?#mutable-sequence-types).\n",
768+
"If you are curious to know more about the methods available for a `list`, look at this [section](https://docs.python.org/3.6/library/stdtypes.html?highlight=list#lists) of the official Python documentation."
769769
]
770770
},
771771
{

004_Loops.ipynb

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
"cell_type": "markdown",
2020
"metadata": {},
2121
"source": [
22-
"Learning about the `if` conditions has strongly improved your coding powers!\n",
22+
"Learning about the `if` conditional statement has strongly improved your coding powers!\n",
2323
"\n",
2424
"You know what a `list` is from the [Lists of Variables notebook](002_Lists_of_Variables.ipynb), and how to interact with this useful data container.\n",
2525
"\n",
2626
"After the [Conditional Execution notebook](003_Conditional_Execution.ipynb), you can now also organize your code so that some actions are executed only when one or more specific conditions are `True`.\n",
2727
"\n",
28-
"In this notebook, we will combine what you learned up to now by using a coding mechanism that iterates through all the elements in a list: the `for` loop."
28+
"We will now combine what you have learned by using a new coding mechanism: the `for` loop."
2929
]
3030
},
3131
{
@@ -41,7 +41,7 @@
4141
"source": [
4242
"<img align=\"left\" width=\"6%\" style=\"padding-right:10px;\" src=\"images/key.png\">\n",
4343
"\n",
44-
"A `for` loop is used to iterate through a sequence of elements (e.g., a list)."
44+
"A `for` loop is used to move through items (**iterate**) in a sequence of elements such as a list."
4545
]
4646
},
4747
{
@@ -50,16 +50,16 @@
5050
"source": [
5151
"Similarly to the [`if`](003_Conditional_Execution.ipynb#Applying-Conditions-with-if,-elif,-and-else) statement, a `for` loop requires that:\n",
5252
"\n",
53-
"- The condition following the `for` keyword must be `True`. (There is a subsequent element in the sequence.)\n",
54-
"- You add an `:` at the end of the `for` condition.\n",
53+
"- There must be a subsequent element in the sequence; the condition following the `for` keyword must be `True`. \n",
54+
"- You add a `:` at the end of the `for` condition.\n",
5555
"- You indent all the lines of code that have to be executed in each iteration."
5656
]
5757
},
5858
{
5959
"cell_type": "markdown",
6060
"metadata": {},
6161
"source": [
62-
"Let's put these requirements in practice in the following code:"
62+
"Let us put these requirements in practice in the following code:"
6363
]
6464
},
6565
{
@@ -68,9 +68,9 @@
6868
"metadata": {},
6969
"outputs": [],
7070
"source": [
71-
"temp_list = [21.3, 21.7, 22.0, 22.5, 21.9] # temperature measures in degree Celsius\n",
71+
"temp_list = [21.3, 21.7, 22.0, 22.5, 21.9] # temperatures in degrees Celsius\n",
7272
"\n",
73-
"for temp_value in temp_list: # `temp_value` is the variable that temporarily stores the subsequent value in the list\n",
73+
"for temp_value in temp_list: # `temp_value` temporarily stores the subsequent value in the list\n",
7474
" temp_str = str(temp_value) # type-casting the `float` to a `str` for printing its value in the next row \n",
7575
" print(\"The temperature is \" + temp_str + \" degree Celsius.\")"
7676
]
@@ -79,19 +79,18 @@
7979
"cell_type": "markdown",
8080
"metadata": {},
8181
"source": [
82-
"By executing the above **Code** cell, the `print()` function will be called five times. Once for each item in the `temp_list`."
82+
"The `print()` function will be called five times by executing the above **Code** cell. Once for each item in the `temp_list`."
8383
]
8484
},
8585
{
8686
"cell_type": "markdown",
8787
"metadata": {},
8888
"source": [
89-
"The header of the above `for` loop is very descriptive of what is going to happen! \n",
89+
"The header of the above `for` loop is very descriptive of what is going to happen! <br>\n",
90+
"You can almost read the `for temp_value in temp_list:` as plain English. That is, `for` each temperature value `in` the list do *something*. And the *something* is what is in the indented body of the loop:\n",
9091
"\n",
91-
"In fact, you can almost read the `for temp_value in temp_list:` as plain English. That is, `for` each temperature value `in` the list do *something*. And the *something* is what is in the indented body of the loop:\n",
92-
"\n",
93-
"- Convert the `temp_value` in a string.\n",
94-
"- Print the value in a sentence that is reader friendly (e.g., `The temperature is 21.3 degree Celsius.`). "
92+
"- Convert the `temp_value` into a string.\n",
93+
"- Print the temperature value in a sentence that is reader friendly (e.g., `The temperature is 21.3 degree Celsius.`). "
9594
]
9695
},
9796
{
@@ -104,7 +103,7 @@
104103
{
105104
"cell_type": "markdown",
106105
"metadata": {
107-
"solution2": "shown",
106+
"solution2": "hidden",
108107
"solution2_first": true
109108
},
110109
"source": [
@@ -117,7 +116,7 @@
117116
"cell_type": "code",
118117
"execution_count": null,
119118
"metadata": {
120-
"solution2": "shown"
119+
"solution2": "hidden"
121120
},
122121
"outputs": [],
123122
"source": [
@@ -155,9 +154,9 @@
155154
"cell_type": "markdown",
156155
"metadata": {},
157156
"source": [
158-
"The `break` and `continue` keywords permit the creation of efficient loops.\n",
157+
"The `break` and `continue` keywords allow for the creation of efficient loops.\n",
159158
"\n",
160-
"For instance, assuming that you want to be sure that a list of temperatures has at least a value higher than 10 degree Celsius. Using `break`, you can stop the iteration when that condition is `True`."
159+
"For instance, assuming that you want to be sure that a list of temperatures has at least a value higher than 10 degrees Celsius. Using `break`, you can stop the iteration when that condition is `True`."
161160
]
162161
},
163162
{
@@ -166,14 +165,14 @@
166165
"metadata": {},
167166
"outputs": [],
168167
"source": [
169-
"temp_list = [1.6, 11.7, 12.1, 2.4, 8.9] # temperature measures in degree Celsius\n",
168+
"temp_list = [1.6, 11.7, 12.1, 2.4, 8.9] # temperatures in degrees Celsius\n",
170169
"\n",
171170
"for temp_value in temp_list:\n",
172171
" \n",
173-
" print(\"Temperature value: \" + str(temp_value)) # an alternate way to print the value by type-casting it on the fly\n",
172+
" print(\"Temperature value: \" + str(temp_value)) # Here `temp_value` is type-casted within the `print` function \n",
174173
" \n",
175174
" if temp_value > 10:\n",
176-
" print(\"BREAK: At least one temperature value is higher than 10 degree Celsius.\")\n",
175+
" print(\"BREAK: At least one temperature value is higher than 10 degrees Celsius.\")\n",
177176
" break # if the execution reach this point, the loop stops"
178177
]
179178
},
@@ -234,7 +233,7 @@
234233
"source": [
235234
"<img align=\"left\" width=\"6%\" style=\"padding-right:10px;\" src=\"images/test.png\">\n",
236235
"\n",
237-
"Using `break` or `continue`, modify the code to **stop** the printing of sound speed values when the **first** value is outside of the validity range from 1400 m/s to 1600 m/s. (If you do not remember how to use the **logical operator**, read the [Conditional Execution notebook](003_Conditional_Execution.ipynb#Boolean-Expressions) again.)"
236+
"Using `break` or `continue`, modify the code to **stop** the printing of sound speed values when the **first** value is outside of the validity range from 1400 m/s to 1600 m/s. (Hint: if you do not remember how to use the **logical operators**, read the [Conditional Execution notebook](003_Conditional_Execution.ipynb#Boolean-Expressions) again)"
238237
]
239238
},
240239
{
@@ -347,7 +346,7 @@
347346
"source": [
348347
"<img align=\"left\" width=\"6%\" style=\"padding-right:10px;\" src=\"images/key.png\">\n",
349348
"\n",
350-
"The `pop()` method removes (and returns) the last value from a list."
349+
"The `pop()` method removes the last value from a list, and also provides back (**returns**) this value. Thus, the removed value can be used for additional processing."
351350
]
352351
},
353352
{
@@ -356,13 +355,14 @@
356355
"metadata": {},
357356
"outputs": [],
358357
"source": [
359-
"ss_list = [1500.6, 1501.3, 1498.2, 1504.4] # sound speed in m/sec\n",
358+
"ss_list = [1500.6, 1501.3, 1498.2, 1504.4] # sound speed in m/s\n",
360359
"\n",
361360
"while len(ss_list) > 0:\n",
362361
" \n",
363362
" nr_values = len(ss_list)\n",
364-
" print(\"Values in the list: \" + str(nr_values))\n",
365-
" ss_list.pop()"
363+
" print(\"Values in the list: \" + str(ss_list))\n",
364+
" removed_value = ss_list.pop()\n",
365+
" print(\"Removed element: \" + str(removed_value))"
366366
]
367367
},
368368
{
@@ -385,7 +385,7 @@
385385
"metadata": {},
386386
"outputs": [],
387387
"source": [
388-
"ss_list = [1500.6, 1501.3, 1498.2, 1504.4] # sound speed in m/sec\n",
388+
"ss_list = [1500.6, 1501.3, 1498.2, 1504.4] # sound speed in m/s\n",
389389
"\n",
390390
"while len(ss_list) > 0:\n",
391391
" \n",

dynamically_and_strongly_typed.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"cell_type": "markdown",
4040
"metadata": {},
4141
"source": [
42-
"## Statically vs. Dinamically Typing"
42+
"## Statically vs. Dynamically Typing"
4343
]
4444
},
4545
{

0 commit comments

Comments
 (0)